:root {
  --gruen: #3b7d14;
  --gruen-hell: #dcefc9;
  --gruen-dunkel: #24500a;
  --blau: #2f7fc1;
  --blau-hell: #d6e9f8;
  --rot: #b3261e;
  --text: #1f2421;
  --text-leise: #5d665f;
  --linie: #d5dbd3;
  --flaeche: #ffffff;
  --grund: #f4f6f2;
  --schrift: "Nunito Sans", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--schrift);
  color: var(--text);
  background: var(--grund);
  font-size: 15px;
  line-height: 1.45;
}

/* ---------- Knöpfe und Felder ---------- */

.knopf {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; min-height: 36px; padding: 6px 14px;
  border: 1px solid var(--linie); border-radius: 8px;
  background: var(--flaeche); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.knopf:hover { background: #eef2ec; }
.knopf:disabled { opacity: .5; cursor: default; }
.knopf.haupt { background: var(--gruen); border-color: var(--gruen); color: #fff; }
.knopf.haupt:hover { background: var(--gruen-dunkel); }
.knopf.gefahr { color: var(--rot); border-color: #e3b4b0; }
.knopf.gefahr:hover { background: #fbeceb; }
.knopf.leise { border-color: transparent; background: transparent; }
:focus-visible { outline: 3px solid var(--blau); outline-offset: 2px; }

label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--text-leise); }
input, select, textarea {
  font: inherit; font-size: 15px; color: var(--text);
  padding: 7px 10px; border: 1px solid #b9c2b7; border-radius: 6px; background: #fff; width: 100%;
}
textarea { resize: vertical; }
label.haken { flex-direction: row; align-items: center; gap: 8px; font-size: 14px; }
label.haken input { width: auto; }

.fehler { margin: 0; padding: 8px 10px; border-radius: 6px; background: #fbeceb; color: var(--rot); font-weight: 600; }
.stand { margin: 0; color: var(--text-leise); font-size: 13px; }
.hinweis { margin: 8px 0 0; color: var(--text-leise); font-size: 13px; }
.flex1 { flex: 1; }

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

body.anmeldung { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.anmeldekarte {
  width: min(380px, 100%); background: var(--flaeche); border-radius: 14px;
  padding: 28px; box-shadow: 0 8px 30px rgba(0, 0, 0, .08); text-align: center;
}
.anmeldelogo { width: 220px; max-width: 100%; }
.anmeldekarte h1 { font-size: 20px; margin: 12px 0 20px; }
.anmeldekarte form { display: flex; flex-direction: column; gap: 12px; text-align: left; }

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

.kopf {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 8px 16px; background: var(--flaeche); border-bottom: 1px solid var(--linie);
}
.kopflogo { height: 44px; }
.kopftitel { font-weight: 700; font-size: 17px; flex: 1; }
.kopfnav { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Arbeitsfläche ---------- */

.arbeitsflaeche {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px;
  padding: 16px; align-items: start;
}
.planbereich { min-width: 0; }
.reiter { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 10px; }
.reiterknopf {
  font: inherit; font-weight: 600; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--linie); background: var(--flaeche); cursor: pointer; color: var(--text);
}
.reiterknopf[aria-selected="true"] { background: var(--gruen); border-color: var(--gruen); color: #fff; }

.plan { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 12px; padding: 12px; }
.plantitel { margin: 0 0 8px; font-size: 18px; font-weight: 700; }
.grundriss { display: block; width: 100%; height: auto; max-height: calc(100vh - 230px); }

.umriss { fill: #e8efe4; stroke: #2c2c2c; stroke-width: 5; stroke-linejoin: round; }
.f-treppe { fill: #d4dccf; stroke: #6b746a; stroke-width: 1.5; }
.f-aufzug { fill: #fff; stroke: #2c2c2c; stroke-width: 2.5; }
.f-luft { fill: #f7f9f5; stroke: #9aa397; stroke-width: 2; stroke-dasharray: 8 6; }
.f-flur { fill: #e8efe4; stroke: none; }
.f-linie { fill: none; stroke: #8a9187; stroke-width: 2; }
.formname { fill: #8a9187; text-anchor: middle; font-style: italic; pointer-events: none; }

.raum { cursor: pointer; outline: none; }
.raumflaeche { fill: #fff; stroke: #2c2c2c; stroke-width: 3; transition: fill .12s; }
.raum:hover .raumflaeche { fill: var(--blau-hell); }
.raum:focus-visible .raumflaeche { stroke: var(--blau); stroke-width: 6; }
.raum.belegt .raumflaeche { fill: var(--gruen-hell); }
.raum.belegt:hover .raumflaeche { fill: #c8e5ad; }
.raum.gewaehlt .raumflaeche { fill: #bcdcf6; stroke: var(--blau); stroke-width: 6; }
.raum text { text-anchor: middle; pointer-events: none; }
.raumname { fill: #7b8479; }
.raumnummer { fill: var(--gruen-dunkel); font-weight: 800; }
.raumtext { fill: #2c2c2c; font-weight: 600; }

/* ---------- Seitenleiste ---------- */

.seitenleiste {
  width: 380px; background: var(--flaeche); border: 1px solid var(--linie); border-radius: 12px;
  padding: 14px 16px 18px; position: sticky; top: 16px;
  max-height: calc(100vh - 32px); overflow: auto;
}
.seitenleiste[hidden] { display: none; }
#raumformular { display: flex; flex-direction: column; gap: 10px; }
.leistenkopf { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.leistenkopf h2 { margin: 0; font-size: 18px; }
.planname { margin: -6px 0 2px; color: var(--text-leise); font-size: 13px; }
.zweier { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
details { border: 1px dashed var(--linie); border-radius: 8px; padding: 6px 10px; }
details[open] { display: flex; flex-direction: column; gap: 8px; padding-bottom: 10px; }
summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-leise); }
.knopfreihe { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.knopfreihe.rechts { justify-content: flex-end; margin-top: 12px; }
.vorschau { margin-top: 16px; }
.vorschau .schild { box-shadow: 0 2px 12px rgba(0, 0, 0, .15); }

/* ---------- Dialoge ---------- */

.dialog {
  border: none; border-radius: 14px; padding: 16px 18px 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25); width: min(900px, calc(100vw - 32px));
}
.dialog::backdrop { background: rgba(20, 30, 20, .35); }
.suche { margin: 12px 0; }
.tabellenrahmen { max-height: 60vh; overflow: auto; border: 1px solid var(--linie); border-radius: 8px; }
.tabelle { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabelle th { position: sticky; top: 0; background: #eef2ec; text-align: left; padding: 6px 10px; font-size: 13px; }
.tabelle td { padding: 6px 10px; border-top: 1px solid var(--linie); }
.tabelle tbody tr { cursor: pointer; }
.tabelle tbody tr:hover { background: #f3f8ef; }
.tabelle td input { width: auto; }
.druckoptionen { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; margin: 12px 0; }
.druckoptionen label:not(.haken) { width: 230px; }

@media (max-width: 900px) {
  .arbeitsflaeche { grid-template-columns: 1fr; }
  .seitenleiste { width: 100%; position: static; max-height: none; }
  .kopftitel { flex-basis: 100%; order: 3; }
}

/* ---------- Türschild ---------- */

.schild {
  position: relative; width: 100%; aspect-ratio: 1 / 1;
  container-type: inline-size;
  background: #fff; border-radius: 3cqw; overflow: hidden;
  font-family: var(--schrift); color: #262626;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.schild-grund { position: absolute; inset: 0; width: 100%; height: 100%; }
.schild-logo { position: absolute; left: 26%; top: 4.2%; width: 48%; }
.schild-mitte {
  position: absolute; left: 5%; right: 5%; top: 38.5%; bottom: 23%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: .6cqw;
}
.schild-mitte > div { width: 100%; white-space: nowrap; overflow: hidden; }
.schild-gross { font-size: 15.5cqw; font-weight: 800; color: var(--gruen); line-height: 1.12; letter-spacing: -.02em; }
.schild-mitte > .schild-gross.zweizeilig {
  white-space: normal; overflow-wrap: anywhere; line-height: 1.08;
  overflow: visible;
}
.schild-klein { font-size: 7.6cqw; font-style: italic; font-weight: 600; line-height: 1.2; }
.schild-nummer { font-size: 7cqw; font-weight: 500; line-height: 1.2; }
.schild-fuss {
  position: absolute; left: 5.5%; right: 5.5%; top: 85.5%; height: 9%;
  display: flex; justify-content: space-between; align-items: center;
}
.schild-nachbar { display: flex; align-items: center; gap: 3.5cqw; width: 48%; min-width: 0; }
.schild-nachbar.rechts { justify-content: flex-end; }
.schild-nachbar span { font-size: 5cqw; font-weight: 500; white-space: nowrap; overflow: hidden; min-width: 0; }
.pfeil { width: 12.5cqw; height: 10.4cqw; fill: #2b2b2b; flex: none; }

/* ---------- Druck ---------- */

.druckbereich { display: none; }
.druckbereich.messen { display: block; position: fixed; left: -100000px; top: 0; }
.druckseite {
  width: 210mm; height: 297mm; display: grid; place-content: center; gap: 10mm;
  break-after: page; page-break-after: always;
}
.druckseite:last-child { break-after: auto; page-break-after: auto; }
.druckseite.je-4 { grid-template-columns: repeat(2, var(--schild)); }
.druckseite .schild { width: var(--schild); }
.mit-schnitt .schild { box-shadow: 0 0 0 .25mm #9a9a9a; }

@page { size: A4 portrait; margin: 0; }

@media print {
  body { background: #fff; }
  body > *:not(.druckbereich) { display: none !important; }
  .druckbereich { display: block !important; position: static !important; }
}
