:root {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: #f5f6f8;
  color: #1c2530;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* Muss jede display-Regel (z. B. .kopfzeile { display: flex }) ueberschreiben koennen. */
[hidden] {
  display: none !important;
}

.kopfzeile {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: #1c2530;
  color: #fff;
}

.kopfzeile select,
.kopfzeile button {
  margin-left: auto;
}

.anmelde-bereich {
  max-width: 24rem;
  margin: 10vh auto;
  padding: 2rem;
  background: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.anmelde-bereich form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.app-bereich {
  max-width: 64rem;
  margin: 1.5rem auto;
  padding: 0 1rem;
}

.reiter {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.reiter-knopf {
  padding: 0.5rem 1rem;
  border: 1px solid #c7ccd4;
  background: #fff;
  color: #1c2530;
  border-radius: 0.375rem 0.375rem 0 0;
  cursor: pointer;
}

.reiter-knopf:hover,
.reiter-knopf:focus-visible {
  background: #e3e6eb;
  color: #1c2530;
}

.reiter-knopf.aktiv {
  background: #1c2530;
  color: #fff;
}

.ansicht {
  background: #fff;
  border-radius: 0.5rem;
  padding: 1.25rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.bereich-kopf {
  margin-bottom: 1.25rem;
}

.bereich-kopf h1 {
  margin: 0 0 0.2rem;
  font-size: 1.4rem;
}

.bereich-untertitel {
  margin: 0;
  color: #5a6472;
  font-size: 0.92rem;
}

.werkzeugleiste {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

/* Grundbreite statt flex: 1, damit "Neue Person"/"Neue Firma" auf schmalen Bildschirmen
   in die naechste Zeile umbrechen, statt das Suchfeld zu ueberdecken. */
.suchfeld {
  flex: 1 1 16rem;
  min-width: 0;
}

.werkzeugleiste input[type='search'] {
  width: 100%;
  min-width: 10rem;
  padding: 0.55rem 0.7rem;
}

button.primaer {
  background: #0f5132;
  font-weight: 600;
}

button.primaer:hover {
  background: #146c43;
}

.statuszeile {
  min-height: 1.4rem;
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: #5a6472;
}

.statuszeile--laedt {
  color: #5a6472;
}

.statuszeile--fehler {
  color: #b42318;
  font-weight: 600;
}

.statuszeile--leer {
  color: #5a6472;
  font-style: italic;
}

.statuszeile--hinweis {
  color: #8a5a00;
}

.kunden-buehne {
  display: grid;
  grid-template-columns: minmax(0, 22rem) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.kunden-spalte-liste {
  min-width: 0;
}

.kunden-spalte-detail {
  min-width: 0;
  background: #fafbfc;
  border: 1px solid #e3e6eb;
  border-radius: 0.5rem;
  padding: 1.25rem;
}

/* Personen und Firmen teilen sich eine scrollbare Spalte, getrennt in ueberschriebene Gruppen. */
.kunden-listen {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 70vh;
  overflow-y: auto;
}

.kunden-listengruppe-titel {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  margin: 0 0 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
}

.kunden-listengruppe-anzahl {
  color: #5a6472;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.kunden-liste {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.kunden-eintrag {
  min-width: 0;
}

.kunden-eintrag-knopf {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  min-width: 0;
  background: #fff;
  color: #1c2530;
  border: 1px solid #e3e6eb;
  border-radius: 0.4rem;
  padding: 0.55rem 0.7rem;
  text-align: left;
  cursor: pointer;
}

.kunden-eintrag-knopf:hover {
  border-color: #c7ccd4;
}

.kunden-eintrag-knopf.ausgewaehlt {
  background: #eef2ff;
  border-color: #1c2530;
}

.kunden-eintrag-name {
  flex: 1 1 8rem;
  min-width: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.kunden-eintrag-nummer {
  flex: 0 0 auto;
  color: #5a6472;
  font-size: 0.85rem;
}

.kunden-eintrag-kontakt {
  flex: 1 1 7rem;
  min-width: 0;
  color: #5a6472;
  font-size: 0.85rem;
  overflow-wrap: anywhere;
  text-align: right;
}

/* Firmen: linke Kante plus Textmarker "Firma" - erkennbar auch ohne Farbwahrnehmung. */
.kunden-eintrag-knopf--firma {
  border-left: 3px solid #1c2530;
}

.kunden-eintrag-art {
  flex: 0 0 auto;
  padding: 0 0.35rem;
  border: 1px solid #c7ccd4;
  border-radius: 0.2rem;
  color: #1c2530;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.5;
}

.kunden-leerzustand {
  color: #5a6472;
}

.kunden-akte-kopf {
  margin-bottom: 1rem;
}

.kunden-akte-kopf h2 {
  margin: 0 0 0.3rem;
}

.kunden-akte-unterzeile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  color: #5a6472;
  font-size: 0.9rem;
}

.kunden-gruppe {
  margin-bottom: 1.25rem;
}

.kunden-gruppe h3,
.formular-gruppe h3 {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
  color: #334155;
}

.formular-gruppe {
  margin-bottom: 1.25rem;
}

.hinweistext {
  margin: 0.25rem 0;
  color: #5a6472;
  font-size: 0.88rem;
}

.erfolgstext {
  margin: 0 0 1rem;
  padding: 0.5rem 0.7rem;
  border-left: 3px solid #0f5132;
  background: #e6f4ea;
  color: #0f5132;
  border-radius: 0.25rem;
}

.statuszeile--erfolg {
  color: #0f5132;
  font-weight: 600;
}

/* Verknuepfte Akten (Ansprechpartner einer Firma, Firmen einer Person, Suchtreffer). */
.verknuepfungs-liste {
  list-style: none;
  margin: 0;
  padding: 0;
}

.verknuepfungs-liste li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid #eef0f3;
}

.verknuepfung-meta {
  color: #5a6472;
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.verknuepfung-aktion {
  margin-left: auto;
}

button.verweis-knopf {
  min-height: 1.75rem;
  padding: 0.2rem 0;
  background: none;
  color: #1c2530;
  font-weight: 600;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: #9aa3af;
  text-underline-offset: 0.2em;
}

button.verweis-knopf:hover {
  background: none;
  text-decoration-color: currentColor;
}

.ansprechpartner-gruppe .statuszeile {
  min-height: 0;
  margin: 0 0 0.4rem;
}

.zuordnen-bereich {
  margin-top: 1rem;
  padding: 0.85rem;
  border: 1px solid #e3e6eb;
  border-radius: 0.4rem;
  background: #fff;
}

.zuordnen-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.zuordnen-bereich input[type='search'] {
  width: 100%;
}

.zuordnen-treffer {
  max-height: 16rem;
  overflow-y: auto;
}

.zuordnen-treffer-name {
  font-weight: 600;
}

.nur-schmal {
  display: none;
}

.tabelle {
  width: 100%;
  border-collapse: collapse;
}

.tabelle th,
.tabelle td {
  text-align: left;
  padding: 0.5rem;
  border-bottom: 1px solid #e3e6eb;
  vertical-align: top;
}

form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

form label input,
form label select {
  width: 100%;
}

input,
select,
button {
  font: inherit;
  padding: 0.45rem;
  border-radius: 0.3rem;
  border: 1px solid #c7ccd4;
}

button {
  cursor: pointer;
  background: #1c2530;
  color: #fff;
  border: none;
}

button:hover {
  background: #334155;
}

button.sekundaer {
  background: #e3e6eb;
  color: #1c2530;
}

.formular-knopfzeile {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.fehlertext {
  color: #b42318;
  min-height: 1.2rem;
}

.feld-zeile {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid #eef0f3;
  flex-wrap: wrap;
}

.feld-name {
  min-width: 8rem;
  font-weight: 600;
}

.abschnitt {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #e3e6eb;
}

.hinweis {
  background: #fff6e5;
  border: 1px solid #f0c674;
  padding: 0.6rem;
  border-radius: 0.3rem;
  margin: 0.5rem 0;
}

.status-abzeichen {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.1rem 0.55rem;
  border-radius: 1rem;
  font-size: 0.8rem;
  background: #e3e6eb;
  flex: 0 0 auto;
}

.status-abzeichen .punkt {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
}

.status-abzeichen--aktiv {
  background: #e6f4ea;
  color: #0f5132;
}

.status-abzeichen--inaktiv {
  background: #eef0f3;
  color: #5a6472;
}

@media (max-width: 48rem) {
  .kunden-buehne {
    grid-template-columns: 1fr;
  }
  .nur-schmal {
    display: inline-block;
  }
  .kunden-buehne[data-ansicht='leer'] .kunden-spalte-detail {
    display: none;
  }
  .kunden-buehne:not([data-ansicht='leer']) .kunden-spalte-liste {
    display: none;
  }
  .kunden-eintrag-knopf {
    flex-wrap: wrap;
  }
  .kunden-eintrag-kontakt {
    text-align: left;
  }
}

@media (max-width: 40rem) {
  .app-bereich {
    padding: 0 0.5rem;
  }
  .feld-zeile {
    flex-direction: column;
  }
  .feld-name {
    min-width: unset;
  }
  .kopfzeile {
    flex-wrap: wrap;
  }
  .kunden-spalte-detail {
    padding: 0.9rem;
  }
}

/* Das Profil steuert nur die authentifizierte MFS-Ansicht. */
body.mfs-intranet-design {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: var(--mfs-workspace);
  color: var(--mfs-text);
  font-family: Montserrat, system-ui, sans-serif;
}

.mfs-intranet-design :is(.kopfzeile, .mfs-design-abschluss) {
  background: var(--mfs-frame);
  color: var(--mfs-on-frame);
}

.mfs-intranet-design .kopfzeile {
  min-height: 5.75rem;
  padding: 0.875rem clamp(1rem, 3vw, 2rem);
  gap: 0.75rem 1.25rem;
}

.mfs-design-logo {
  width: 6rem;
  height: auto;
  flex: none;
}

.mfs-intranet-design .kopfzeile button {
  border: 1px solid var(--mfs-on-frame);
  background: transparent;
  color: var(--mfs-on-frame);
}

.mfs-intranet-design .kopfzeile button:hover {
  background: var(--mfs-on-frame);
  color: var(--mfs-frame);
}

.mfs-intranet-design .app-bereich {
  flex: 1;
  width: min(100%, 64rem);
}

.mfs-design-abschluss {
  min-height: 1.75rem;
}

.mfs-intranet-design :is(.ansicht, .kunden-eintrag-knopf, .kunden-spalte-detail, .reiter-knopf) {
  background: var(--mfs-surface);
  color: var(--mfs-text);
  border-color: var(--mfs-outline);
}

.mfs-intranet-design :is(.bereich-untertitel, .statuszeile--laedt, .statuszeile--leer, .kunden-eintrag-kontakt) {
  color: var(--mfs-secondary-text);
}

.mfs-intranet-design :is(.reiter-knopf:hover, .kunden-eintrag-knopf:hover, button.sekundaer) {
  background: var(--mfs-highlight);
  color: var(--mfs-text);
}

.mfs-intranet-design .kunden-eintrag-knopf {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 0.3rem 0.6rem;
}

.mfs-intranet-design .kunden-eintrag-kontakt {
  grid-column: 1 / -1;
  grid-row: 2;
  text-align: left;
}

.mfs-intranet-design .kunden-eintrag-knopf.ausgewaehlt {
  background: var(--mfs-highlight);
  border-color: var(--mfs-frame);
}

.mfs-intranet-design :is(.reiter-knopf.aktiv, button.primaer) {
  background: var(--mfs-frame);
  color: var(--mfs-on-frame);
}

.mfs-intranet-design button.primaer:hover {
  background: var(--mfs-secondary-text);
}

.mfs-intranet-design :is(a, button, select, input, textarea):focus-visible {
  outline: 2px solid var(--mfs-text);
  outline-offset: 2px;
}

.mfs-intranet-design .kopfzeile :focus-visible {
  outline-color: var(--mfs-focus);
}

@media (max-width: 40rem) {
  .mfs-intranet-design .kopfzeile {
    min-height: 4.5rem;
  }
  .mfs-design-logo {
    width: 4.25rem;
  }
}
