/* Oberfläche für Mitarbeiter und Admin. Mobil zuerst, ohne Framework. */
:root {
    --gruen: #2f4a3c;
    --gruen-hell: #456b57;
    --sand: #f7f5f0;
    --papier: #fff;
    --linie: #ddd8cd;
    --text: #23211d;
    --grau: #6b665c;
    --rot: #a33529;
    --gelb: #a8752a;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--sand);
    color: var(--text);
    font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.6rem 0 .6rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
a { color: var(--gruen); }
img { max-width: 100%; display: block; }

.innen { max-width: 1000px; margin: 0 auto; padding: 0 .9rem; }

/* --- Kopf ---------------------------------------------------------------- */
.kopf { background: var(--gruen); color: #fff; }
.kopf-zeile { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding-top: .6rem; padding-bottom: .6rem; }
.marke { color: #fff; text-decoration: none; font-weight: 700; letter-spacing: .02em; }
.nav { display: flex; gap: .8rem; flex: 1 1 auto; flex-wrap: wrap; }
.nav a { color: #d9e5dd; text-decoration: none; font-size: .95rem; }
.nav a:hover { color: #fff; text-decoration: underline; }
.nav a.hervor { color: #fff; font-weight: 600; }
.abmelden { display: flex; align-items: center; gap: .5rem; }
.wer { font-size: .85rem; color: #cfded5; }

main { padding: 1rem 0 3rem; }
.fuss { color: var(--grau); font-size: .85rem; padding-bottom: 2rem; }

/* --- Meldungen ----------------------------------------------------------- */
.meldung { padding: .6rem .8rem; border-radius: 5px; margin: 0 0 1rem; }
.meldung.gut { background: #e4efe6; border-left: 4px solid var(--gruen); }
.meldung.schlecht { background: #f7e4e2; border-left: 4px solid var(--rot); }
.meldung.hinweis { background: #f6efdf; border-left: 4px solid var(--gelb); }

/* --- Karten und Formulare ------------------------------------------------ */
.karte { background: var(--papier); border: 1px solid var(--linie); border-radius: 6px; padding: 1rem; margin-bottom: 1rem; }

label { display: block; font-weight: 600; font-size: .9rem; margin: .8rem 0 .2rem; }
label.leicht { font-weight: 400; }

input[type=text], input[type=number], input[type=password], input[type=date],
select, textarea {
    width: 100%;
    padding: .55rem .6rem;
    border: 1px solid var(--linie);
    border-radius: 5px;
    background: #fff;
    font: inherit;
    color: inherit;
}
textarea { min-height: 7rem; resize: vertical; }
input[type=file] { width: 100%; font: inherit; }
.feld-hinweis { font-size: .82rem; color: var(--grau); margin: .25rem 0 0; }

.reihe { display: grid; gap: .6rem; }
@media (min-width: 620px) { .reihe.zwei { grid-template-columns: 1fr 1fr; } .reihe.drei { grid-template-columns: 1fr 1fr 1fr; } }

.knopf {
    display: inline-block; padding: .6rem 1rem; border: 1px solid var(--gruen);
    border-radius: 5px; background: var(--gruen); color: #fff; font: inherit;
    font-weight: 600; cursor: pointer; text-decoration: none; text-align: center;
}
.knopf:hover { background: var(--gruen-hell); }
.knopf.still { background: transparent; color: inherit; border-color: var(--linie); font-weight: 400; }
.kopf .knopf.still { color: #fff; border-color: rgba(255,255,255,.4); }
.knopf.gefahr { background: var(--rot); border-color: var(--rot); }
.knopf.gross { width: 100%; padding: .9rem 1rem; font-size: 1.05rem; }
.knopf-reihe { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }

/* --- Objektliste --------------------------------------------------------- */
.filter { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.filter a {
    padding: .35rem .7rem; border: 1px solid var(--linie); border-radius: 999px;
    background: #fff; text-decoration: none; font-size: .88rem; color: var(--text);
}
.filter a.aktiv { background: var(--gruen); color: #fff; border-color: var(--gruen); }

.liste { display: grid; gap: .7rem; }
.eintrag {
    display: flex; gap: .8rem; background: var(--papier); border: 1px solid var(--linie);
    border-radius: 6px; padding: .6rem; color: inherit; align-items: stretch;
}
.eintrag:hover { border-color: var(--gruen-hell); }
/* Der Eintrag ist kein Link mehr, sondern traegt zwei: die Flaeche fuehrt zum
   Bearbeiten, die Aufrufzahl rechts zur Statistik. Verschachtelte <a> sind
   ungueltiges HTML, deshalb die Aufteilung. */
.eintrag-haupt {
    display: flex; gap: .8rem; flex: 1 1 auto; min-width: 0;
    text-decoration: none; color: inherit; align-items: flex-start;
}
.eintrag-stat {
    flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end;
    justify-content: center; gap: .1rem; min-width: 3.4rem; padding-left: .4rem;
    border-left: 1px solid var(--linie);
    font-size: .74rem; color: var(--grau); text-decoration: none;
}
.eintrag-stat .gross { font-size: 1.05rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
a.eintrag-stat:hover .gross { color: var(--gruen); }
.eintrag .bild { flex: 0 0 84px; width: 84px; height: 64px; object-fit: cover; border-radius: 4px; background: #eee9df; }
.eintrag .bild.leer { background: repeating-linear-gradient(45deg,#eee9df,#eee9df 6px,#e6e0d3 6px,#e6e0d3 12px); }
.eintrag .inhalt { flex: 1 1 auto; min-width: 0; }
.eintrag h3 { margin: 0 0 .2rem; font-size: 1rem; }
.eintrag .zeile { font-size: .84rem; color: var(--grau); }

.marke-status {
    display: inline-block; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
    padding: .1rem .45rem; border-radius: 3px; margin-right: .35rem; vertical-align: 1px;
}
.s-erfasst { background: #e8e5dd; color: #5a554a; }
.s-inarbeit { background: #f6e8cd; color: #7d5510; }
.s-online { background: #dcecdf; color: #23543a; }
.s-reserviert { background: #f3e2c8; color: #7a4d10; }
.s-verkauft { background: #e0ddd6; color: #57524a; }
.s-fehler { background: #f8ded9; color: #8c2c20; }

/* --- Medien -------------------------------------------------------------- */
.medien-gitter { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: .6rem; }
.medium { border: 1px solid var(--linie); border-radius: 5px; overflow: hidden; background: #fff; position: relative; }
.medium.inaktiv { opacity: .45; }
.medium img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.medium .werkzeuge { display: flex; gap: .2rem; padding: .25rem; align-items: center; justify-content: space-between; }
.medium .werkzeuge button { border: 1px solid var(--linie); background: #fff; border-radius: 3px; cursor: pointer; font: inherit; font-size: .8rem; padding: .1rem .35rem; }
/* K-Knopf (Foto geht in die Kleinanzeige): Der Zustand muss auf einen Blick
   lesbar sein. Blosse Transparenz reichte nicht — an dem winzigen Knopf war der
   Unterschied nicht wahrnehmbar, der Klick wirkte deshalb wie wirkungslos.
   Jetzt: gewaehlt = gefuellt gruen, abgewaehlt = grau und durchgestrichen. */
.medium .werkzeuge button.ka-gewaehlt {
    background: var(--gruen); border-color: var(--gruen); color: #fff; font-weight: 700;
}
.medium .werkzeuge button.ka-abgewaehlt {
    background: #eceae3; border-color: #c9c4b8; color: var(--grau);
    text-decoration: line-through; text-decoration-thickness: 2px;
}
.medium .nr { font-size: .75rem; color: var(--grau); padding-left: .2rem; }

/* Ziehen zum Sortieren (foto-gitter): antippen ohne Bewegung = Lightbox,
   Bewegung ueber der Schwelle = Ziehen. touch-action:none noetig, damit der
   Browser das Geste nicht selbst als Scroll interpretiert, bevor JS reagiert. */
#foto-gitter .medium img { cursor: zoom-in; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#foto-gitter .medium.wird-gezogen { opacity: .5; outline: 2px dashed var(--gruen); outline-offset: -2px; }

.lightbox {
    position: fixed; inset: 0; background: rgba(20,18,14,.9);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; padding: 1.2rem;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
.lightbox-schliessen {
    position: absolute; top: 1rem; right: 1rem; width: 2.4rem; height: 2.4rem;
    border-radius: 50%; border: 0; background: rgba(255,255,255,.15); color: #fff;
    font-size: 1.2rem; line-height: 1; cursor: pointer;
}
.lightbox-schliessen:hover { background: rgba(255,255,255,.3); }
/* Blaettern und Diashow in der Lightbox. Die Knoepfe liegen ueber dem Bild, sind aber
   gross genug fuer den Daumen — die Bearbeiten-Seite wird ueberwiegend am Handy benutzt. */
.lightbox-pfeil {
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 3rem; height: 3.6rem; border: 0; border-radius: 4px;
    background: rgba(255,255,255,.15); color: #fff; font-size: 2rem; line-height: 1;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.lightbox-pfeil:hover { background: rgba(255,255,255,.3); }
.lightbox-pfeil.zurueck { left: .6rem; }
.lightbox-pfeil.vor { right: .6rem; }
.lightbox-leiste {
    position: absolute; left: 50%; bottom: 1rem; transform: translateX(-50%);
    display: flex; align-items: center; gap: .6rem; color: #fff; font-size: .9rem;
    background: rgba(255,255,255,.15); border-radius: 4px; padding: .1rem .7rem .1rem .1rem;
}
.lightbox-leiste button {
    border: 0; background: none; color: #fff; font-size: 1.15rem; line-height: 1;
    cursor: pointer; padding: .4rem .45rem;
}
#lightbox-zaehler { font-variant-numeric: tabular-nums; }

.fortschritt { height: 8px; background: #e6e1d6; border-radius: 4px; overflow: hidden; margin-top: .5rem; display: none; }
.fortschritt.an { display: block; }
.fortschritt > div { height: 100%; width: 0; background: var(--gruen); transition: width .15s linear; }

/* --- KI-Assistent ---------------------------------------------------------- */
.chat-verlauf {
    max-height: 22rem; overflow-y: auto; display: flex; flex-direction: column; gap: .5rem;
    padding: .6rem; background: #f7f4ec; border: 1px solid var(--linie); border-radius: 5px; margin-bottom: .6rem;
}
.chat-nachricht { max-width: 85%; padding: .5rem .7rem; border-radius: 9px; font-size: .93rem; white-space: pre-wrap; }
.chat-nachricht.nutzer { align-self: flex-end; background: var(--gruen); color: #fff; border-bottom-right-radius: 2px; }
.chat-nachricht.assistent { align-self: flex-start; background: #fff; border: 1px solid var(--linie); border-bottom-left-radius: 2px; }

.aufnahme { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.aufnahme .zeit { font-variant-numeric: tabular-nums; font-size: 1.1rem; color: var(--rot); }

/* --- Tabellen ------------------------------------------------------------ */
.tabelle { width: 100%; border-collapse: collapse; background: #fff; }
.tabelle th, .tabelle td { padding: .5rem .55rem; border-bottom: 1px solid var(--linie); text-align: left; vertical-align: top; font-size: .92rem; }
.tabelle th { background: #f0ece3; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; color: var(--grau); }
.tabelle td.zahl, .tabelle th.zahl { text-align: right; font-variant-numeric: tabular-nums; }
.tabelle tfoot td { font-weight: 700; background: #f4f1e9; }
.tabelle-scroll { overflow-x: auto; border: 1px solid var(--linie); border-radius: 6px; }

/* --- Dokumente ----------------------------------------------------------- */
.dokumente { display: grid; gap: .8rem; margin-top: 1rem; }
.dokument { border: 1px solid var(--linie); border-radius: 5px; padding: .7rem; background: #fbf9f4; }
.dokument-kopf { margin: 0 0 .4rem; display: flex; flex-wrap: wrap; gap: .2rem .6rem; align-items: baseline; }
.dokument-kopf a { font-weight: 600; }
.dokument .kopierblock { font-family: ui-monospace, Consolas, "Courier New", monospace; font-size: .85rem; }
.feld-hinweis code { background: #f0ece3; border-radius: 3px; padding: .05em .3em; font-size: .95em; }

/* Hinweis, der wirklich gelesen werden muss. Eingefuehrt 31.08.2026, nachdem ein
   Bot-Lauf eine bestehende Anzeige samt 14 Merkungen geloescht und neu eingestellt hat. */
.feld-hinweis.warnung { color: var(--text); background: #fdf3e7; border: 1px solid #e6c9a0;
  border-left: 4px solid var(--akzent, #a8642a); border-radius: 6px; padding: .7rem .9rem;
  margin-top: .6rem; font-size: .88rem; }
.feld-hinweis.warnung code { background: #f5e6d2; }

.kopierblock {
    background: #fff; border: 1px solid var(--linie); border-radius: 5px;
    padding: .7rem; white-space: pre-wrap; word-break: break-word; font-size: .93rem;
}
.klein { font-size: .85rem; color: var(--grau); }
.trenner { border: 0; border-top: 1px solid var(--linie); margin: 1.5rem 0; }

/* Prozess- und Protokollausgaben auf der Kleinanzeigen-Seite. Bewusst scrollbar statt
   umbrechend: Bot- und Aufgabenprotokolle sind zeilenorientiert und werden unlesbar,
   wenn jede Zeile dreimal umbricht. */
.protokoll {
    background: #f0ece3; border: 1px solid var(--linie); border-radius: 5px;
    padding: .6rem .7rem; margin: .5rem 0 0;
    font-size: .8rem; line-height: 1.45;
    max-height: 22rem; overflow: auto; white-space: pre;
}

/* --- Statistik ------------------------------------------------------------ */
.kennzahlen { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: .7rem; }
.kennzahl {
    background: var(--papier); border: 1px solid var(--linie); border-radius: 6px;
    padding: .7rem .8rem; display: flex; flex-direction: column; gap: .1rem;
}
.kennzahl .wert { font-size: 1.7rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kennzahl .etikett { font-size: .85rem; }

.karte.graph { padding: .8rem .6rem .4rem; }
.karte.graph svg { width: 100%; height: auto; display: block; }

.legende { list-style: none; margin: 0; padding: 0; display: grid; gap: .25rem; font-size: .9rem; }

/* --- Team-Statistik (Block oben auf der Objektliste) ---------------------- */
/* Absichtlich fuer jeden angemeldeten Nutzer sichtbar, nicht nur fuer den Admin.
   Schmale Bildschirme: Name in der ersten Zeile, die Zahlen brechen darunter um
   (team-werte hat dort flex-basis 100%). */
.karte.team { padding: .8rem .9rem; }
.team-kopf { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .7rem; margin-bottom: .6rem; }
.team-kopf h2 { margin: 0; font-size: 1.05rem; }
.team-liste { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.team-zeile {
    display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .6rem;
    padding: .4rem .5rem; border-radius: 5px; background: #f7f4ec;
    border: 1px solid transparent;
}
.team-zeile.spitze { background: #f4efdf; }
.team-zeile.ich { background: #e4efe6; border-color: var(--gruen-hell); }
.team-zeile.ohne { background: transparent; border-style: dashed; border-color: var(--linie); color: var(--grau); }
.team-platz { flex: 0 0 1.7rem; font-weight: 700; color: var(--grau); font-variant-numeric: tabular-nums; }
.team-zeile.spitze .team-platz { color: var(--gelb); }
.team-name { flex: 1 1 7rem; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-werte { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: .35rem 0; }
/* Feste Zellenbreite, damit die Spalten über alle Zeilen hinweg untereinander
   stehen — mit inhaltsabhängiger Breite verrutschten sie von Zeile zu Zeile. */
.team-wert { flex: 1 1 4.6rem; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.team-wert b { font-size: 1.02rem; font-variant-numeric: tabular-nums; }
.team-wert small { font-size: .7rem; color: var(--grau); white-space: nowrap; }
.team-wert.stark b { font-size: 1.3rem; color: var(--gruen); }
.team-wert.stark small { color: var(--gruen-hell); }
.team-zeile.ohne .team-wert.stark b, .team-zeile.ohne .team-wert.stark small { color: inherit; }
.team-summe { margin: .7rem 0 0; font-size: .84rem; color: var(--grau); }

@media (min-width: 760px) {
    .team-werte { flex: 0 0 auto; justify-content: flex-end; }
    .team-wert { flex: 0 0 5.8rem; }
}
