:root {
  --gruen: #1f5f3f;
  --gruen-hell: #e7f1ec;
  --rot: #b3261e;
  --rot-hell: #fbe9e7;
  --text: #1d1d1b;
  --grau: #6b6b66;
  --linie: #dcdcd6;
  --flaeche: #ffffff;
  --hinter: #f4f4f1;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--hinter);
}

h1, h2, h3 { margin: 0 0 .6em; line-height: 1.2; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; margin-top: 1em; }

input, select, textarea, button { font: inherit; color: inherit; }

input, select, textarea {
  width: 100%;
  padding: .5em .6em;
  border: 1px solid var(--linie);
  border-radius: 6px;
  background: #fff;
}
input[type="checkbox"] { width: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gruen); outline-offset: -1px; }

label { display: flex; flex-direction: column; gap: .25em; font-size: .9rem; color: var(--grau); }
label > input, label > select, label > textarea { color: var(--text); font-size: 1rem; }
label.schalter { flex-direction: row; align-items: center; gap: .5em; margin: .5em 0 1em; color: var(--text); }

button, .knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  padding: .5em 1em;
  border: 1px solid var(--gruen);
  border-radius: 6px;
  background: var(--gruen);
  color: #fff;
  cursor: pointer;
  font-size: .95rem;
}
button:disabled { opacity: .45; cursor: default; }
button.zweit, .knopf.zweit { background: #fff; color: var(--gruen); }
button.link { background: none; border: none; color: var(--gruen); padding: .2em .4em; text-decoration: underline; }
button.gross { width: 100%; padding: .9em; font-size: 1.05rem; margin-top: .5em; }
.rot, button.link.rot { color: var(--rot); }
button.zweit.rot { color: var(--rot); border-color: var(--rot); }

/* Kopfzeile */
.kopf {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5em 1.2em;
  padding: .6em 1.2em;
  background: var(--gruen); color: #fff;
}
.kopf .logo { font-size: 1.1rem; }
.kopf nav { display: flex; flex-wrap: wrap; gap: .2em; flex: 1; }
.kopf nav a { color: #fff; text-decoration: none; padding: .35em .7em; border-radius: 6px; opacity: .85; }
.kopf nav a.aktiv, .kopf nav a:hover { background: rgba(255,255,255,.18); opacity: 1; }
.kopf .wer { font-size: .9rem; }
.kopf .wer button.link { color: #fff; }

.logo .go, .anmeldung h1 .go { color: #f2c94c; }

main { max-width: 1200px; margin: 0 auto; padding: 1.2em; }
main.go { max-width: 760px; padding: 1em; }

.karte {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 1em;
  margin-bottom: 1em;
}

.raster { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .8em; align-items: end; }
.knoepfe { display: flex; flex-wrap: wrap; gap: .5em; align-items: center; margin-top: .6em; }
.raster .knoepfe { margin-top: 0; }

.filter { display: flex; flex-wrap: wrap; gap: .4em; margin: .4em 0 1em; }
.filter button { background: #fff; color: var(--text); border-color: var(--linie); }
.filter button.aktiv { background: var(--gruen-hell); border-color: var(--gruen); color: var(--gruen); font-weight: 600; }

/* Tabellen */
.scroll { overflow-x: auto; }
table.liste { width: 100%; border-collapse: collapse; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); }
table.liste th, table.liste td { padding: .55em .7em; border-bottom: 1px solid var(--linie); text-align: left; vertical-align: top; }
table.liste th { font-size: .82rem; color: var(--grau); font-weight: 600; background: #fafaf8; }
table.liste td input, table.liste td select { min-width: 9em; padding: .3em .4em; }
table.liste td input[type="checkbox"] { min-width: 0; }
.mitte { text-align: center !important; }
.aktionen { white-space: nowrap; text-align: right; }

.klein { font-size: .82rem; color: var(--grau); }
.leer { color: var(--grau); padding: 1em 0; }
.hinweis { background: var(--gruen-hell); padding: .8em 1em; border-radius: var(--radius); }

.marke { display: inline-block; font-size: .72rem; padding: .05em .5em; border-radius: 99px; background: var(--gruen-hell); color: var(--gruen); margin-left: .3em; }
.marke.rot { background: var(--rot-hell); color: var(--rot); }

/* Wartungsarten-Editor */
.frage { display: flex; flex-wrap: wrap; gap: .5em; align-items: center; padding: .5em 0; border-bottom: 1px dashed var(--linie); }
.frage > input[data-f="label"] { flex: 2 1 240px; }
.frage > select { flex: 1 1 200px; }
.frage > input[data-f="opts"] { flex: 2 1 220px; }
.frage > input.schmal { flex: 0 1 110px; }
.werkzeug { display: flex; gap: .25em; }
.werkzeug button { padding: .35em .6em; }

/* Anmeldung */
.anmeldung { max-width: 380px; margin: 10vh auto; display: flex; flex-direction: column; gap: .9em; }
.anmeldung h1 { color: var(--gruen); }

/* Dach-Ansicht (Handy) */
a.auftrag { display: flex; flex-direction: column; gap: .15em; color: inherit; text-decoration: none; }
a.auftrag:active { background: var(--gruen-hell); }
.zurueck { display: inline-block; margin-bottom: .8em; color: var(--gruen); text-decoration: none; font-size: 1rem; }
fieldset { border: none; padding: 0; margin: 0; }
.frage-dach { display: flex; flex-direction: column; gap: .4em; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: .8em; margin-bottom: .6em; color: var(--text); font-size: 1rem; }
.frage-dach > span { font-weight: 600; }
.segment { display: flex; gap: .4em; }
.segment button { flex: 1; padding: .75em .3em; background: #fff; color: var(--text); border-color: var(--linie); }
.segment button.aktiv { background: var(--gruen); color: #fff; border-color: var(--gruen); }
.segment button.mangel.aktiv { background: var(--rot); border-color: var(--rot); }
.zahl { display: flex; align-items: center; gap: .5em; }
.zahl span { color: var(--grau); }
.fotos { display: flex; flex-wrap: wrap; gap: .5em; margin: .6em 0; }
.foto { position: relative; }
.foto img { width: 110px; height: 110px; object-fit: cover; border-radius: 6px; border: 1px solid var(--linie); display: block; }
.foto button { position: absolute; top: 4px; right: 4px; padding: .1em .45em; background: #fff; }
.knopf { width: 100%; padding: .8em; }

/* Objektstruktur */
h4 { margin: 1em 0 .5em; font-size: .95rem; }
.titelzeile { display: flex; flex-wrap: wrap; align-items: center; gap: .6em 1em; margin: 1.2em 0 .6em; }
.titelzeile h3 { margin: 0; }
.ganz { grid-column: 1 / -1; }
#elemente-neu:empty { display: none; }
table.klickbar tbody tr { cursor: pointer; }
table.klickbar tbody tr:hover { background: var(--gruen-hell); }
table.klickbar a { color: var(--gruen); font-weight: 600; text-decoration: none; }
.neues-element { margin-top: .8em; padding-top: .8em; border-top: 1px dashed var(--linie); }
.chips { display: flex; flex-wrap: wrap; gap: .4em; margin-bottom: .4em; }
.chip { display: inline-flex; align-items: center; gap: .1em; padding: .2em .3em .2em .8em; border: 1px solid var(--linie); border-radius: 99px; background: #fafaf8; }
.chip button.link { text-decoration: none; padding: .1em .35em; }

/* Objekte: Umschalter Explorer/Liste */
.umschalter { display: inline-flex; border: 1px solid var(--linie); border-radius: 6px; overflow: hidden; }
.umschalter button { border: none; border-radius: 0; background: #fff; color: var(--text); padding: .35em .9em; }
.umschalter button.aktiv { background: var(--gruen); color: #fff; }

/* Objekte: Explorer */
.explorer { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 1em; align-items: start; }
.explorer-inhalt { min-width: 0; }
.explorer-inhalt > h2:first-child { margin-top: .2em; }
.baum { position: sticky; top: 1em; padding: .6em; display: flex; flex-direction: column; max-height: calc(100vh - 7em); }
.baum-werkzeug { display: flex; gap: .4em; margin-bottom: .5em; }
.baum-werkzeug button { white-space: nowrap; padding: .4em .7em; }
.baum-inhalt { overflow-y: auto; flex: 1; margin: 0 -.3em; }
.baum-fuss { display: flex; justify-content: space-between; border-top: 1px solid var(--linie); padding-top: .4em; margin-top: .4em; }
.baum-fuss button.link { text-decoration: none; font-size: .85rem; }
.knoten {
  display: flex; align-items: center; gap: .35em;
  padding: .28em .5em .28em calc(.3em + var(--ebene) * 1.15em);
  border-radius: 5px; cursor: pointer; user-select: none; white-space: nowrap;
}
.knoten:hover { background: var(--hinter); }
.knoten.aktiv { background: var(--gruen-hell); box-shadow: inset 3px 0 0 var(--gruen); }
.knoten .pfeil { width: 1em; flex: none; text-align: center; color: var(--grau); font-size: .8rem; }
.knoten .symbol { flex: none; width: 1.3em; text-align: center; }
.knoten .symbol[data-emoji-ziel] { cursor: pointer; border-radius: 4px; }
.knoten .symbol[data-emoji-ziel]:hover { background: var(--linie); }
.knoten .name { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.knoten .anzahl { flex: none; font-size: .75rem; color: var(--grau); background: var(--hinter); border-radius: 99px; padding: 0 .5em; }
.markiert { outline: 3px solid var(--gruen); outline-offset: 2px; }
tr.markiert { outline-offset: -2px; background: var(--gruen-hell); }

@media (max-width: 800px) {
  .explorer { grid-template-columns: 1fr; }
  .baum { position: static; max-height: 45vh; }
}

/* Herkunft eines Werts (z. B. „aus Wartung vom …“) und Verknüpfung von Fragen */
.feldhinweis { font-size: .78rem; color: var(--gruen); }
.frage > select[data-f="eigenschaft"] { flex: 1 1 200px; color: var(--gruen); }
label.foto-option { flex-direction: row; align-items: center; gap: .3em; white-space: nowrap; color: var(--text); font-size: .9rem; }
.vorausgefuellt { font-size: .8rem; color: var(--grau); font-weight: normal; }

/* Benutzer und Gruppen */
.inline-form { display: flex; gap: .5em; margin: .6em 0 1.4em; max-width: 480px; }
.gruppenwahl { display: flex; flex-wrap: wrap; align-items: center; gap: .2em 1em; }
.gruppenwahl label.schalter { margin: 0; }
label.klein-schalter { margin: .1em 0; font-size: .85rem; white-space: nowrap; }
table.benutzer td { min-width: 9em; }

/* Fotos je Frage (SolarisGO) und Bericht-Knöpfe */
.frage-fotos { display: flex; flex-wrap: wrap; gap: .4em; align-items: center; }
.frage-fotos .foto img { width: 72px; height: 72px; }
.foto-knopf { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 1px dashed var(--linie); border-radius: 6px; font-size: 1.3rem; cursor: pointer; color: var(--text); }
.foto-knopf:hover { border-color: var(--gruen); background: var(--gruen-hell); }
.frage-fotos .foto-antwort { flex: 1 1 100%; color: #fff; }
.frage-fotos .foto-antwort.zweit { color: var(--gruen); }
.bericht-knoepfe { display: flex; gap: .5em; flex-wrap: wrap; margin: -.3em 0 .8em; }
.bericht-knoepfe button { padding: .4em .8em; font-size: .9rem; }
a.link-knopf { display: inline; padding: .2em .4em; color: var(--gruen); text-decoration: underline; }

/* Gespeicherte Ansichten */
.ansichten-box { display: flex; flex-direction: column; gap: .3em; }
.baum .ansichten-box { margin-bottom: .5em; }
.av-zeile, .av-formular { display: flex; gap: .3em; align-items: center; flex-wrap: wrap; }
.av-zeile select { flex: 1; min-width: 0; width: auto; padding: .35em .4em; }
.av-zeile button, .av-formular button { padding: .35em .7em; white-space: nowrap; }
.av-formular input { flex: 1 1 140px; min-width: 0; padding: .35em .4em; }
.av-formular select { width: auto; padding: .35em .4em; }
.filter .ansichten-box { margin-left: .5em; min-width: 260px; }

/* Excel-Import */
.import-schritte p { margin: .4em 0; }
a.knopf.import-knopf, label.knopf.import-knopf { width: auto; display: inline-flex; padding: .55em 1.2em; text-decoration: none; }
.import-hinweise summary { cursor: pointer; color: var(--gruen); font-weight: 600; margin: .3em 0; }
.import-hinweise ul { margin: .3em 0 .6em 1.2em; padding: 0; font-size: .88rem; }
.marke.grau { background: var(--hinter); color: var(--grau); }
.import-box { margin-bottom: 1em; }

/* Historie im Objekt */
.naechste-wartung { padding: .7em 1em; }

/* Zeitraum in der Wartungsliste */
label.zeitraum { flex-direction: row; align-items: center; gap: .4em; margin-left: auto; color: var(--text); }
label.zeitraum select { width: auto; padding: .35em .5em; }

/* Objekt-Filter */
button.filter-aktiv { background: var(--gruen); color: #fff; }
.filter-box { margin-bottom: .5em; }
.filter-box:not(.karte) { border-bottom: 1px solid var(--linie); padding-bottom: .5em; }
.filterpanel .bedingung { border: 1px solid var(--linie); border-radius: 6px; padding: .4em; margin-bottom: .4em; background: var(--hinter); }
.filterpanel .bedingung > select { width: 100%; margin-bottom: .3em; }
.bedingung-zeile { display: flex; gap: .3em; align-items: center; }
.bedingung-zeile > select, .bedingung-zeile > input { flex: 1; min-width: 0; padding: .35em .4em; }
.bedingung-zeile > button { padding: .3em .55em; flex: none; }
.filterpanel .klein { margin: .3em 0 0; }
.filter-info { font-size: .82rem; color: var(--gruen); margin: 0 0 .4em; }
.filter-info button.link { font-size: .82rem; padding: 0 .3em; }
.listen-werkzeug { display: flex; align-items: center; gap: .8em; margin: .4em 0 .6em; }

/* Vorschau der Namen beim Anlegen mehrerer Elemente */
.vorschau-namen { margin: 0; color: var(--gruen); font-weight: 600; }
.vorschau-namen:empty { display: none; }
form.raster > h4.ganz { margin: .4em 0 -.3em; }

/* Bereiche und Bereichsarten */
.symbol-gross { font-size: 1.4rem; line-height: 1; }
button.symbol-knopf { width: auto; align-self: flex-start; font-size: 1.4rem; line-height: 1; padding: .15em .3em; background: transparent; border: 1px dashed var(--linie); color: inherit; }
button.symbol-knopf:hover { border-color: var(--gruen); }
button.emoji-zelle { text-decoration: none; font-size: 1.1rem; padding: 0 .2em; }
dialog.emoji-dialog { width: min(460px, calc(100% - 2em)); }
.emoji-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(2.4em, 1fr)); gap: .25em; margin: .6em 0; }
.emoji-knopf { font-size: 1.3rem; padding: .2em 0; background: transparent; border: 1px solid transparent; color: inherit; }
.emoji-knopf:hover { background: var(--hinter); border-color: var(--linie); }
.emoji-knopf.aktiv { border-color: var(--gruen); background: var(--gruen-hell); }
.emoji-frei { display: flex; gap: .5em; align-items: end; }
.emoji-frei label { flex: 1; }
.bereich-kopf { margin: 0 0 .6em; }
.bereich-kopf h4, .art h4 { margin: 0; }
.karte.art { padding: .7em 1em; }
.karte.art .titelzeile { margin: 0; }

/* Objekt: Reiter */
.reiter { display: flex; flex-wrap: wrap; gap: .2em; border-bottom: 2px solid var(--linie); margin-bottom: 1em; }
.reiter button { background: none; border: none; border-radius: 6px 6px 0 0; color: var(--grau); padding: .55em 1em; margin-bottom: -2px; border-bottom: 2px solid transparent; }
.reiter button:hover { color: var(--text); background: var(--hinter); }
.reiter button.aktiv { color: var(--gruen); border-bottom-color: var(--gruen); font-weight: 600; }
.reiter-inhalt > h3:first-child, .reiter-inhalt > .titelzeile:first-child { margin-top: 0; }
fieldset { min-width: 0; }
fieldset.raster { border: 1px solid var(--linie); }

/* Bemerkungen */
.notizblatt { min-height: 9em; background: #fffdf3; border-color: #ead9a2; line-height: 1.5; }
.neue-bemerkung { margin-bottom: 1em; }
.eintrag { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: .6em .8em; margin-bottom: .5em; }
.eintrag .text { white-space: pre-wrap; margin-top: .2em; }
.eintrag button.link { float: right; font-size: .8rem; padding: 0; }
.notiz-go { background: #fffdf3; border: 1px solid #ead9a2; border-radius: var(--radius); padding: .8em; margin-bottom: .8em; }
.notiz-go div { white-space: pre-wrap; margin-top: .3em; }

/* Dokumente */
.ablage { border: 2px dashed var(--linie); border-radius: var(--radius); padding: 1em; text-align: center; margin-bottom: 1em; background: var(--flaeche); }
.ablage p { margin: .3em 0; }
.ablage .knopf { width: auto; padding: .5em 1.2em; }
.ablage.drueber { border-color: var(--gruen); background: var(--gruen-hell); }
.dokumente { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .8em; align-items: start; }
.dok.drueber { outline: 3px dashed var(--gruen); outline-offset: 2px; background: var(--gruen-hell); }
.dateisymbol { font-weight: 700; border: 2px solid; border-radius: 4px; padding: .3em .6em; }
.dateisymbol.pdf { color: var(--rot); }
.dateisymbol.tabelle { color: #1d6f42; }
.dateisymbol.text { color: #2b579a; }
.dateisymbol.praesentation { color: #c43e1c; }
.dok .aktionen { display: flex; flex-wrap: wrap; gap: 0 .2em; white-space: normal; }
.link-knopf { flex-direction: row; display: inline; color: var(--gruen); text-decoration: underline; cursor: pointer; font-size: .95rem; padding: .2em .4em; }
.versionen { border-top: 1px dashed var(--linie); margin-top: .3em; padding-top: .3em; }
.version { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .5em; padding: .15em 0; }
.version a { color: var(--gruen); font-weight: 600; }
.dok { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: .5em; display: flex; flex-direction: column; gap: .2em; min-width: 0; }
.dok .vorschau { display: flex; align-items: center; justify-content: center; height: 130px; background: var(--hinter); border-radius: 5px; overflow: hidden; text-decoration: none; }
.dok .vorschau img { width: 100%; height: 100%; object-fit: cover; }
.dok .pdf { font-weight: 700; color: var(--rot); border: 2px solid var(--rot); border-radius: 4px; padding: .3em .6em; }
.dok-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dok .aktionen { text-align: left; }

/* Wartungsarten: Abschnitte */
.gruppe { border-top: 1px solid var(--linie); margin-top: 1em; padding-top: .3em; }
.gruppe .titelzeile { margin: .6em 0 .2em; }
label.quote { flex-direction: row; align-items: center; gap: .4em; color: var(--text); }
label.quote input { width: 5em; }
.neue-gruppe select { max-width: 320px; }
.speichern { border-top: 1px solid var(--linie); margin-top: 1em; padding-top: 1em; }

/* Dialog: Elemente auswählen */
dialog.auswahl { width: min(720px, calc(100% - 2em)); max-height: 85vh; border: none; border-radius: var(--radius); padding: 1.2em; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
dialog.auswahl::backdrop { background: rgba(0,0,0,.35); }
dialog.auswahl h3 { display: flex; flex-wrap: wrap; gap: .3em .8em; align-items: baseline; }
.elementliste { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .1em 1em; }
.elementliste label.schalter { margin: .2em 0; align-items: flex-start; }
.zaehler { font-size: .82rem; font-weight: normal; }
.gruen { color: var(--gruen); }
.platz { flex: 1; }

/* SolarisGO: Elemente */
details.element { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); margin-bottom: .5em; }
details.element > summary { display: flex; justify-content: space-between; align-items: center; gap: 1em; padding: .8em; cursor: pointer; list-style: none; font-size: 1rem; }
details.element > summary::-webkit-details-marker { display: none; }
details.element > summary::before { content: '▸'; color: var(--grau); }
details.element[open] > summary::before { content: '▾'; }
details.element > summary > span:first-child { flex: 1; }
details.element[open] { padding-bottom: .3em; }
details.element .frage-dach { border: none; border-top: 1px solid var(--linie); border-radius: 0; margin: 0; }
.fortschritt { font-size: .85rem; padding: .1em .6em; border-radius: 99px; background: var(--gruen-hell); color: var(--gruen); }
.fortschritt.rot { background: var(--rot-hell); color: var(--rot); }

/* Kurzmeldungen */
.meldung {
  position: fixed; left: 50%; bottom: 1.2em; transform: translateX(-50%);
  padding: .7em 1.2em; border-radius: var(--radius);
  background: var(--gruen); color: #fff; box-shadow: 0 4px 16px rgba(0,0,0,.2);
  z-index: 100; max-width: calc(100% - 2em);
}
.meldung.fehler { background: var(--rot); }

@media (max-width: 700px) {
  main { padding: .8em; }
  .kopf { padding: .6em .8em; }
}
