/* Immobilien-Verwaltung – Admin-Oberfläche */
:root {
    --blau: #2e45b5;
    --blau-dunkel: #22348a;
    --blau-hell: #eef1fb;
    --text: #1d2433;
    --text-leise: #5f6b80;
    --linie: #dde2ea;
    --flaeche: #f5f7fa;
    --weiss: #fff;
    --gruen: #1d7a46;
    --gruen-hell: #e6f4ec;
    --rot: #b42318;
    --rot-hell: #fdecea;
    --gelb-hell: #fff7e0;
    --radius: 8px;
    --schatten: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
    --schrift: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--schrift); color: var(--text); background: var(--flaeche); }
a { color: var(--blau); }
a:hover { color: var(--blau-dunkel); }
img { max-width: 100%; height: auto; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; }
code { background: var(--blau-hell); padding: .05em .35em; border-radius: 4px; font-size: .9em; }
.unsichtbar { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hinweis { color: var(--text-leise); font-size: .875rem; margin: .25rem 0 .75rem; }
.text-klein { font-size: .85rem; }
.leer { padding: 2rem; text-align: center; color: var(--text-leise); background: var(--weiss); border: 1px dashed var(--linie); border-radius: var(--radius); }
.anzahl { display: inline-block; font-size: .8rem; font-weight: 600; color: var(--text-leise); background: var(--weiss); border: 1px solid var(--linie); border-radius: 99px; padding: .05rem .55rem; vertical-align: middle; }
.monospace { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }

/* Kopf und Navigation */
.kopf { display: flex; align-items: center; gap: 1rem; padding: .6rem 1.25rem; background: var(--weiss); border-bottom: 1px solid var(--linie); position: sticky; top: 0; z-index: 20; }
.marke { display: flex; align-items: center; gap: .6rem; color: var(--text); text-decoration: none; font-weight: 700; line-height: 1.15; }
.marke small { display: block; font-weight: 400; font-size: .78rem; color: var(--text-leise); }
.marke-zeichen { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 8px; background: var(--blau); color: #fff; font-size: .85rem; letter-spacing: .03em; }
.kopf-benutzer { margin-left: auto; display: flex; align-items: center; gap: .75rem; font-size: .9rem; }
.kopf-benutzer form { margin: 0; }
.rolle { color: var(--text-leise); font-size: .8rem; }
.menue-knopf { display: none; margin-left: auto; }
.rahmen { display: flex; min-height: calc(100vh - 3.5rem); }
.navi { flex: 0 0 210px; padding: 1rem .75rem; background: var(--weiss); border-right: 1px solid var(--linie); }
.navi a { display: block; padding: .5rem .75rem; margin-bottom: 2px; border-radius: 6px; color: var(--text); text-decoration: none; }
.navi a:hover { background: var(--flaeche); }
.navi a.aktiv { background: var(--blau-hell); color: var(--blau); font-weight: 600; }
.inhalt { flex: 1; min-width: 0; padding: 1.5rem clamp(1rem, 3vw, 2.25rem) 3rem; max-width: 1400px; }

/* Seitenkopf, Reiter, Brotkrumen */
.seitenkopf { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.brotkrumen { margin: 0 0 .25rem; font-size: .85rem; color: var(--text-leise); }
.brotkrumen a { color: inherit; }
.reiter { display: flex; gap: .25rem; border-bottom: 1px solid var(--linie); margin-bottom: 1.25rem; overflow-x: auto; }
.reiter a { padding: .6rem 1rem; text-decoration: none; color: var(--text-leise); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.reiter a:hover { color: var(--text); }
.reiter a.aktiv { color: var(--blau); border-bottom-color: var(--blau); font-weight: 600; }
.knopfgruppe { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Meldungen */
.meldung { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid; }
.meldung.erfolg { background: var(--gruen-hell); border-color: #b7dfc7; color: #12502e; }
.meldung.fehler { background: var(--rot-hell); border-color: #f5c2bd; color: #7a1a12; }
.meldung.info { background: var(--gelb-hell); border-color: #f0dc9c; color: #5c4600; }
.demo-hinweis { background: #5c4600; color: #fff7e0; text-align: center; padding: .4rem 1rem; font-size: .9rem; }

/* Knöpfe */
.knopf { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem 1rem; border: 1px solid var(--blau); border-radius: 6px; background: var(--blau); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; line-height: 1.2; }
.knopf:hover { background: var(--blau-dunkel); color: #fff; }
.knopf.leise { background: var(--weiss); color: var(--text); border-color: var(--linie); font-weight: 500; }
.knopf.leise:hover { background: var(--flaeche); color: var(--text); }
.knopf.gefahr { background: var(--rot); border-color: var(--rot); }
.knopf.gefahr:hover { background: #8f1b12; }
.knopf.gefahr-leise { background: var(--weiss); color: var(--rot); border-color: #f0c3be; font-weight: 500; }
.knopf.gefahr-leise:hover { background: var(--rot-hell); }
.knopf.klein { padding: .3rem .65rem; font-size: .85rem; }
.knopf.breit { width: 100%; }
.knopf:focus-visible, .schalter:focus-visible, .symbol:focus-visible { outline: 3px solid rgba(46, 69, 181, .35); outline-offset: 2px; }
.schalter { border: 1px solid; border-radius: 99px; padding: .15rem .65rem; font: inherit; font-size: .8rem; cursor: pointer; background: none; }
.schalter.an, .marke-status.an { color: var(--gruen); background: var(--gruen-hell); border-color: #b7dfc7; }
.schalter.aus, .marke-status.aus { color: #7a4a00; background: #fff1d6; border-color: #f0d49c; }
.schalter:hover { filter: brightness(.95); }
.marke-status { display: inline-block; border: 1px solid; border-radius: 99px; padding: .05rem .55rem; font-size: .75rem; white-space: nowrap; }
.symbol { width: 2rem; height: 2rem; border: 1px solid var(--linie); background: var(--weiss); border-radius: 6px; cursor: pointer; font-size: .95rem; }
.symbol:hover:not(:disabled) { background: var(--flaeche); }
.symbol:disabled { opacity: .35; cursor: default; }
.symbol.gefahr { color: var(--rot); }
.link-knopf { background: none; border: 0; padding: 0; color: var(--blau); text-decoration: underline; cursor: pointer; font: inherit; }

/* Formulare */
.formular fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.formular fieldset:disabled input, .formular fieldset:disabled select, .formular fieldset:disabled textarea { background: var(--flaeche); color: var(--text); }
.feld { display: flex; flex-direction: column; gap: .3rem; margin-bottom: 1rem; }
.feld > span { font-weight: 600; font-size: .9rem; }
.feld > span small, legend small { font-weight: 400; color: var(--text-leise); }
.feld abbr { color: var(--rot); text-decoration: none; }
input[type=text], input[type=search], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=date], input[type=datetime-local], select, textarea {
    width: 100%; padding: .55rem .7rem; border: 1px solid #c9d0db; border-radius: 6px; font: inherit; color: var(--text); background: var(--weiss);
}
textarea { resize: vertical; min-height: 4rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blau); box-shadow: 0 0 0 3px rgba(46, 69, 181, .15); }
.hat-fehler input, .hat-fehler select, .hat-fehler textarea { border-color: var(--rot); }
.feldfehler { color: var(--rot); font-size: .85rem; }
.haken { display: flex; align-items: flex-start; gap: .5rem; margin: .35rem 0; cursor: pointer; }
.haken input { margin-top: .25rem; width: 1rem; height: 1rem; accent-color: var(--blau); }
.gruppe { background: var(--weiss); border: 1px solid var(--linie) !important; border-radius: var(--radius); padding: 1rem 1.25rem .5rem !important; margin-bottom: 1rem !important; }
.gruppe legend { font-weight: 700; padding: 0 .35rem; }
.raster { display: grid; gap: 0 1.25rem; }
.raster.zwei { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.raster.drei { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.haken-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 1rem; margin-bottom: .75rem; }
.feld.schmal { max-width: 10rem; }
.formular-knoepfe { display: flex; gap: .75rem; flex-wrap: wrap; padding-top: .5rem; }
.inline-formular { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; }
.inline-formular .feld { margin-bottom: 0; min-width: 12rem; }
.inline-formular .feld.schmal { min-width: 6rem; }

/* Filterleiste */
.filterleiste { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; background: var(--weiss); border: 1px solid var(--linie); border-radius: var(--radius); padding: .9rem 1rem; margin-bottom: 1rem; }
.filterleiste .feld { margin: 0; min-width: 9rem; }
.filterleiste .suchfeld { flex: 1 1 16rem; }
.filter-knoepfe { display: flex; gap: .5rem; }

/* Tabellen */
.tabelle-rahmen { position: relative; overflow-x: auto; background: var(--weiss); border: 1px solid var(--linie); border-radius: var(--radius); box-shadow: var(--schatten); margin-bottom: 1rem; }
.tabelle { width: 100%; border-collapse: collapse; }
.tabelle th, .tabelle td { padding: .65rem .8rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--linie); }
.tabelle th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-leise); background: #fafbfc; font-weight: 600; white-space: nowrap; }
.tabelle tbody tr:last-child td { border-bottom: 0; }
.tabelle tbody tr:hover { background: #fafbfd; }
.tabelle .hinweis { margin: 0; }
.tabelle .aktionen { white-space: nowrap; text-align: right; }
.tabelle .aktionen a { margin-left: .75rem; font-size: .9rem; }
.tabelle .aktionen form { display: inline; }
.objektliste .titel { font-weight: 600; text-decoration: none; }
.objektliste .titel:hover { text-decoration: underline; }
.objektliste .bildspalte { width: 84px; }
.objektliste .bildspalte img { width: 72px; height: 54px; object-fit: cover; border-radius: 4px; display: block; background: var(--flaeche); }
.kein-bild { display: grid; place-items: center; width: 72px; height: 54px; border-radius: 4px; background: var(--flaeche); color: var(--text-leise); }
.merkmale { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .3rem; }
.merkmale span { font-size: .72rem; background: var(--flaeche); border: 1px solid var(--linie); border-radius: 4px; padding: 0 .35rem; color: var(--text-leise); }
.auswahlspalte { width: 2.5rem; }
.einrueckung { display: inline-block; width: calc(var(--ebene, 0) * 1.5rem); }
.ast { color: var(--text-leise); margin-right: .25rem; }
.sammelaktionen { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1.5rem; }
.feld.inline { margin: 0; }
.feld.inline select { width: auto; }

/* Seitennavigation */
.seiten { display: flex; flex-wrap: wrap; gap: .25rem; justify-content: center; margin: 1rem 0; }
.seiten a, .seiten span { min-width: 2.25rem; padding: .35rem .6rem; text-align: center; border-radius: 6px; text-decoration: none; }
.seiten a { background: var(--weiss); border: 1px solid var(--linie); }
.seiten a:hover { background: var(--blau-hell); }
.seiten .aktiv { background: var(--blau); color: #fff; font-weight: 600; }
.seiten .luecke { color: var(--text-leise); }

/* Karten und Kacheln (Startseite) */
.karte { background: var(--weiss); border: 1px solid var(--linie); border-radius: var(--radius); padding: 1.1rem 1.25rem; margin-bottom: 1rem; box-shadow: var(--schatten); }
.kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.kachel { background: var(--weiss); border: 1px solid var(--linie); border-radius: var(--radius); padding: 1rem; text-decoration: none; color: var(--text); box-shadow: var(--schatten); }
a.kachel:hover { border-color: var(--blau); }
.kachel strong { display: block; font-size: 1.75rem; line-height: 1.1; color: var(--blau); }
.kachel span { color: var(--text-leise); font-size: .875rem; }
.kachel.warnung strong { color: var(--rot); }
.spalten { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.einfache-liste { list-style: none; margin: 0; padding: 0; }
.einfache-liste li { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .6rem; padding: .5rem 0; border-bottom: 1px solid var(--linie); }
.einfache-liste li:last-child { border-bottom: 0; }
.einfache-liste .hinweis { margin: 0; }

/* Gefahrenzone */
.gefahrenzone { margin-top: 2rem; border: 1px solid #f0c3be; background: #fffafa; border-radius: var(--radius); padding: 1rem 1.25rem; }
.gefahrenzone h2 { color: var(--rot); }
.gefahrenzone p { margin-top: 0; }

/* Bilder */
.upload { display: flex; gap: .75rem; align-items: stretch; flex-wrap: wrap; margin-bottom: 1.25rem; }
.upload-feld { flex: 1 1 20rem; position: relative; display: flex; align-items: center; gap: .75rem; padding: 1rem 1.25rem; border: 2px dashed #b7c0d1; border-radius: var(--radius); background: var(--weiss); cursor: pointer; }
.upload-feld:hover, .upload-feld.ziehen { border-color: var(--blau); background: var(--blau-hell); }
.upload-feld input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-text small { color: var(--text-leise); }
.upload.laeuft { opacity: .6; pointer-events: none; }
.bildraster { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .9rem; }
.bildkarte { background: var(--weiss); border: 1px solid var(--linie); border-radius: var(--radius); overflow: hidden; box-shadow: var(--schatten); }
.bildkarte[draggable=true] { cursor: grab; }
.bildkarte.zieht { opacity: .4; }
.bildkarte.ziel { outline: 3px solid var(--blau); }
.bildkarte:first-child { border-color: var(--blau); }
.bildkarte-bild { display: block; aspect-ratio: 3 / 2; background: var(--flaeche); }
.bildkarte-bild img { width: 100%; height: 100%; object-fit: contain; display: block; }
.bildkarte-fuss { display: flex; align-items: center; gap: .5rem; padding: .45rem .55rem; }
.bildkarte-fuss .nummer { font-weight: 700; min-width: 1.5rem; }
.bildkarte-fuss .hinweis { margin: 0; flex: 1; font-size: .75rem; }
.bildkarte-aktionen { display: flex; gap: .25rem; }
.bildkarte-aktionen form { display: flex; gap: .25rem; margin: 0; }

/* Vorschau */
.vorschau-rahmen { background: var(--weiss); border: 1px solid var(--linie); border-radius: var(--radius); padding: 1rem 1.25rem; }

/* Login */
.login-seite { display: grid; place-items: center; min-height: 100vh; padding: 1rem; background: linear-gradient(160deg, #eef1fb, #f5f7fa 60%); }
.login-karte { width: min(100%, 380px); background: var(--weiss); border: 1px solid var(--linie); border-radius: 12px; padding: 2rem; box-shadow: 0 10px 30px rgba(16, 24, 40, .08); }
.login-karte .marke { margin-bottom: 1.5rem; }
.login-karte h1 { font-size: 1.3rem; margin-bottom: 1rem; }

/* Fehlerseite */
.fehlerseite { text-align: center; padding: 3rem 1rem; }
.fehlercode { font-size: 3rem; font-weight: 800; color: var(--linie); margin: 0; }

/* Mobil */
@media (max-width: 900px) {
    .raster.drei { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .breit-nur { display: none; }
}
@media (max-width: 760px) {
    .menue-knopf { display: inline-flex; padding: .4rem .8rem; border: 1px solid var(--linie); background: var(--weiss); border-radius: 6px; font: inherit; }
    .kopf { flex-wrap: wrap; }
    .kopf-benutzer { width: 100%; margin-left: 0; justify-content: space-between; display: none; }
    .kopf.offen .kopf-benutzer { display: flex; }
    .rahmen { display: block; }
    .navi { display: none; border-right: 0; border-bottom: 1px solid var(--linie); }
    .navi.offen { display: block; }
    .raster.zwei, .raster.drei { grid-template-columns: 1fr; }
    .tabelle .aktionen { text-align: left; white-space: normal; }
    .tabelle .aktionen a { margin: 0 .75rem 0 0; }
    h1 { font-size: 1.35rem; }
}
