/* Erfassungs-Chat (Premium-Erfassung). Baut auf style.css auf: Farben, Radien, Schatten, Knöpfe.
   Alle Klassen tragen die Vorsilbe ec-, damit kein Datenwert und keine Seitenregel kollidiert
   (Docs/PITFALLS/datenwert_als_css_klasse_erbt_seitenregel.md). Gestaltung nach dem Mockup
   entwurf/erfassungs-chat/ (Handy 390 px, Desktop 1440 px). */

.ec-seite { background: var(--creme); }
.ec-unsichtbar { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.ec-nur-klein { display: none !important; }

/* ------------------------------------------------ Rahmen: Desktop zweispaltig */
.ec {
  width: min(1180px, 94vw); margin: 1.1rem auto 1.4rem;
  display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 1.4rem;
  height: calc(100dvh - 130px); min-height: 560px;
}
.ec-seite .fuss { display: none; }

.ec-chat {
  background: #fff; border-radius: var(--radius); box-shadow: var(--schatten); border-top: 3px solid var(--warn);
  display: flex; flex-direction: column; min-height: 0; overflow: hidden; position: relative;
}
.ec-chat.ec-ziehen { outline: 3px dashed var(--akzent); outline-offset: -6px; }
.ec-chatkopf { display: flex; align-items: center; gap: .7rem; padding: .65rem 1.1rem; border-bottom: 1px solid var(--grau-hell); flex: none; }
.ec-heim img { display: block; }
.ec-titel { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.ec-titel b { font-size: 1.02rem; }
.ec-titel b span { color: var(--warn); }
.ec-titel small { color: var(--grau); font-size: .76rem; font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ec-kopfknopf {
  margin-left: auto; font: inherit; font-size: .8rem; color: var(--akzent-dunkel); border: 1px solid var(--grau-hell);
  border-radius: 999px; padding: .3rem .8rem; background: var(--creme); cursor: pointer; white-space: nowrap;
}

/* ------------------------------------------------ Verlauf */
.ec-verlauf {
  list-style: none; margin: 0; padding: 1rem 1.1rem .8rem; flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: .8rem; background: var(--creme); scroll-behavior: smooth;
  overscroll-behavior: contain;
}
.ec-verlauf > li { max-width: 86%; font-size: .94rem; line-height: 1.45; }
.ec-zeile-person { align-self: flex-end; display: flex; flex-direction: column; align-items: flex-end; gap: .25rem; }
.ec-zeile-agent { align-self: flex-start; }
.ec-blinken .ec-blase { animation: ec-blinken 1.5s ease; }
@keyframes ec-blinken { 0%, 60% { box-shadow: 0 0 0 4px var(--warn); } 100% { box-shadow: none; } }

.ec-blase { border-radius: 16px; padding: .55rem .85rem; overflow-wrap: anywhere; }
.ec-person { background: var(--akzent); color: #fff; border-bottom-right-radius: 4px; }
.ec-person.ec-knopfwahl { background: var(--akzent-hell); color: var(--akzent-dunkel); border: 1px solid var(--akzent); font-weight: 600; }
.ec-mik { opacity: .85; }
.ec-agent { background: #fff; color: var(--navy); border: 1px solid var(--grau-hell); border-bottom-left-radius: 4px; box-shadow: var(--schatten-s); }
.ec-agent.ec-fehler { background: #FBEAE8; border-color: #E9B8B1; }
.ec-antwort { margin: 0; }
.ec-antwort + .ec-quittungen { margin-top: .45rem; }
.ec-quittungen { list-style: none; margin: 0; padding: 0; display: grid; gap: .28rem; }
.ec-quittungen li { padding-left: 1.2rem; text-indent: -1.2rem; }
.ec-quittungen .ec-ok { color: var(--navy); }
.ec-quittungen .ec-ok::first-letter { color: #2E7D5B; font-weight: 700; }
.ec-quittungen .ec-info { color: #6B4A12; }
.ec-datenschutz { font-size: .8rem; color: var(--grau); margin: .5rem 0 0; background: var(--creme); border-radius: 8px; padding: .4rem .55rem; }
.ec-status { font-size: .74rem; color: var(--grau); display: flex; align-items: center; gap: .35rem; }
.ec-dreh { width: .8rem; height: .8rem; border-radius: 50%; border: 2px solid var(--akzent); border-right-color: transparent; display: inline-block; animation: ec-dreh .9s linear infinite; flex: none; }
@keyframes ec-dreh { to { transform: rotate(360deg); } }
.ec-unterwegs { opacity: .75; }

.ec-bildknopf { position: relative; display: block; padding: 0; border: 0; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: var(--schatten-s); cursor: zoom-in; width: 220px; max-width: 64vw; }
.ec-bildknopf img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.ec-bildnr { position: absolute; top: .35rem; left: .35rem; background: rgba(11,35,52,.85); color: #fff; font-size: .7rem; font-weight: 700; border-radius: 999px; padding: .05rem .5rem; }

.ec-beleg {
  font: inherit; font-size: .78em; border: 1px solid var(--grau-hell); background: var(--creme); color: var(--akzent-dunkel);
  border-radius: 999px; padding: 0 .45rem; cursor: pointer; text-decoration: none; white-space: nowrap; display: inline-block; line-height: 1.5;
}
.ec-beleg.ec-zitat { white-space: normal; }
.ec-stand { display: inline-block; font-size: .62rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; border-radius: 999px; padding: .04rem .45rem; vertical-align: .12em; background: #EEF0F2; color: #4D5B5F; white-space: nowrap; }
.ec-stand-abgelesen { background: #E3F2E9; color: #23613F; }
.ec-stand-gesehen { background: var(--akzent-hell); color: var(--akzent-dunkel); }
.ec-stand-ihre_korrektur { background: #EDE7F6; color: #4B3A78; }
.ec-stand-vorschlag, .ec-stand-schaetzung { background: var(--warn-hell); color: #8A5A12; }

.ec-frage { margin-top: .55rem; background: var(--warn-hell); border: 1px solid #EBCF9F; border-left: 4px solid var(--warn); border-radius: var(--radius-s); padding: .6rem .75rem; }
.ec-frage b { display: block; }
.ec-frage p { margin: .15rem 0 0; font-size: .82rem; color: #6B4A12; }
.ec-frage.ec-alt { opacity: .6; }
.ec-wahlen { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .55rem; }
.ec-wahl { font: inherit; font-size: .86rem; background: #fff; border: 1px solid #E2C48F; border-radius: 999px; padding: .38rem .85rem; color: var(--navy); cursor: pointer; min-height: 2.2rem; }
.ec-wahl:hover:not(:disabled) { border-color: var(--akzent); color: var(--akzent-dunkel); }
.ec-wahl:disabled { cursor: default; opacity: .7; }
.ec-wahlen .knopf { padding: .6rem 1.1rem; font-size: .92rem; }

.ec-karte { margin-top: .5rem; border: 1px solid var(--akzent); background: linear-gradient(170deg, var(--akzent-hell), #fff 60%); border-radius: var(--radius-s); padding: .8rem .9rem; }
.ec-karte.ec-alt { opacity: .65; }
.ec-braue { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 700; color: var(--akzent-tief); }
.ec-satz { font-size: 1.02rem; line-height: 1.5; margin: .3rem 0 .5rem; color: var(--navy); font-weight: 600; }
.ec-angaben { width: 100%; border-collapse: collapse; font-size: .8rem; }
.ec-angaben td { padding: .22rem .3rem .22rem 0; border-top: 1px solid var(--grau-hell); vertical-align: top; }
.ec-angaben td:first-child { color: var(--grau); }
.ec-klein { font-size: .8rem; color: var(--grau); margin: .45rem 0 0; }

.ec-kontakt { margin-top: .6rem; background: #fff; border: 1px solid var(--grau-hell); border-radius: var(--radius-s); padding: .85rem .9rem; box-shadow: var(--schatten-s); max-width: 560px; }
.ec-felder { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem .7rem; margin: .6rem 0 .8rem; }
.ec-felder label { display: flex; flex-direction: column; font-size: .78rem; color: var(--grau); gap: .15rem; }
.ec-felder .ec-breit { grid-column: 1 / -1; }
.ec-felder input { font: inherit; font-size: 1rem; border: 1px solid var(--grau-hell); border-radius: 8px; padding: .45rem .6rem; color: var(--navy); background: var(--creme); min-width: 0; }

/* ------------------------------------------------ Eingabeleiste */
.ec-leiste { flex: none; background: #fff; border-top: 1px solid var(--grau-hell); padding: .55rem .9rem .6rem; }
.ec-zeile { display: flex; gap: .45rem; align-items: flex-end; }
.ec-rund {
  width: 2.65rem; height: 2.65rem; border-radius: 50%; border: 1px solid var(--grau-hell); background: var(--creme);
  font-size: 1.12rem; display: grid; place-items: center; flex: none; color: var(--navy); padding: 0; cursor: pointer; position: relative;
}
.ec-rund:focus-within, .ec-rund:focus-visible { outline: 2px solid var(--akzent); outline-offset: 1px; }
.ec-mikro.ec-an { background: #C0392B; border-color: #C0392B; color: #fff; animation: ec-puls 1.2s ease infinite; }
@keyframes ec-puls { 50% { box-shadow: 0 0 0 6px rgba(192,57,43,.2); } }
#ec-text {
  flex: 1; min-width: 0; min-height: 2.65rem; max-height: 140px; resize: none; border: 1px solid var(--grau-hell); border-radius: 1.32rem;
  padding: .62rem 1rem; font: inherit; font-size: 1rem; line-height: 1.35; background: var(--creme); color: var(--navy);
}
#ec-text:focus { outline: 2px solid var(--akzent); outline-offset: 0; background: #fff; }
.ec-senden { width: 2.65rem; height: 2.65rem; border-radius: 50%; border: 0; background: var(--akzent); color: #fff; font-size: 1.05rem; flex: none; cursor: pointer; }
.ec-senden:disabled, .ec-rund:has(input:disabled) { opacity: .45; cursor: default; }
.ec-tipp { font-size: .74rem; color: var(--grau); margin: .35rem 0 0 .2rem; }
.ec-meldung { font-size: .84rem; color: #6B4A12; background: var(--warn-hell); border-radius: 8px; padding: .35rem .6rem; margin: 0 0 .45rem; }
.ec-anhaenge { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin-bottom: .45rem; }
.ec-anhang { position: relative; }
.ec-anhang img { width: 58px; height: 44px; object-fit: cover; border-radius: 7px; display: block; border: 1px solid var(--grau-hell); }
.ec-anhang button { position: absolute; top: -7px; right: -7px; width: 1.3rem; height: 1.3rem; border-radius: 50%; border: 0; background: var(--navy); color: #fff; font-size: .7rem; cursor: pointer; padding: 0; }
.ec-aufnahme { display: flex; align-items: center; gap: .5rem; font-size: .9rem; color: #8A2E25; background: #FBEAE8; border-radius: 10px; padding: .4rem .6rem; margin-bottom: .45rem; }
.ec-rec { width: .7rem; height: .7rem; border-radius: 50%; background: #C0392B; animation: ec-puls 1.2s ease infinite; }
.ec-aufnahme-stop { margin-left: auto; font: inherit; font-weight: 700; border: 0; background: #C0392B; color: #fff; border-radius: 999px; padding: .3rem .9rem; cursor: pointer; }
.ec-aufnahme-weg { font: inherit; border: 0; background: transparent; color: #8A2E25; cursor: pointer; }

/* ------------------------------------------------ Erfassung (rechts) */
.ec-erfassung { background: #fff; border-radius: var(--radius); box-shadow: var(--schatten); min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.ec-erfassung-kopf { display: flex; align-items: flex-start; gap: .6rem; padding: .85rem 1.1rem .7rem; border-bottom: 1px solid var(--grau-hell); flex: none; }
.ec-fehlt { font-size: .86rem; margin-top: .2rem; line-height: 1.4; }
.ec-fehlt b { color: #8A5A12; }
.ec-erfassung-inhalt { padding: .2rem 1.1rem 1.1rem; overflow-y: auto; min-height: 0; flex: 1; overscroll-behavior: contain; }
.ec-gruppe h3 { font-size: .9rem; margin: 1rem 0 .4rem; }
.ec-gruppe h3 small { font-weight: 400; color: var(--grau); font-size: .78rem; margin-left: .3rem; }
.ec-raum { border: 1px solid var(--grau-hell); border-radius: var(--radius-s); padding: .5rem .65rem; }
.ec-raum + .ec-raum { margin-top: .45rem; }
.ec-raumkopf { display: flex; align-items: center; gap: .45rem; margin-bottom: .2rem; }
.ec-id { font-family: var(--mono); font-size: .68rem; color: var(--grau); background: var(--creme); border-radius: 5px; padding: 0 .3rem; }
.ec-raumkopf .ec-stift { margin-left: auto; }
.ec-feld { display: grid; grid-template-columns: 5.6rem minmax(0, 1fr) auto; gap: .1rem .5rem; font-size: .84rem; padding: .18rem 0; align-items: baseline; }
.ec-was { color: var(--grau); }
.ec-wert small { display: block; color: var(--grau); font-size: .76rem; line-height: 1.4; margin-top: .1rem; }
.ec-offen { color: #8A5A12; }
.ec-mini { width: 1.75rem; height: 1.75rem; border-radius: 7px; border: 1px solid var(--grau-hell); background: #fff; color: var(--grau); font-size: .78rem; cursor: pointer; padding: 0; flex: none; }
.ec-mini:hover { color: var(--akzent-dunkel); border-color: var(--akzent); }
.ec-raumkopf .ec-kreuz { margin-left: .2rem; }
.ec-daumen-reihe { display: flex; gap: .3rem; margin-top: .35rem; flex-wrap: wrap; }
.ec-daumen { padding: 0; border: 0; background: none; cursor: zoom-in; }
.ec-daumen img { width: 46px; height: 34px; object-fit: cover; border-radius: 5px; display: block; }
.ec-hinweis { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .2rem .4rem; align-items: start; font-size: .82rem; background: var(--creme); border-radius: 8px; padding: .35rem .5rem; margin-bottom: .3rem; }
.ec-hinweis small { grid-column: 1; color: var(--grau); }
.ec-hinweis .ec-kreuz { grid-row: 1 / span 2; grid-column: 2; }
.ec-bildraster { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: .5rem; }
.ec-bildkachel { position: relative; font-size: .72rem; color: var(--grau); }
.ec-bildkachel img { width: 100%; height: 72px; }
.ec-bildkachel .ec-kreuz { position: absolute; top: .2rem; right: .2rem; width: 1.4rem; height: 1.4rem; font-size: .66rem; }
.ec-leer { font-size: .82rem; color: var(--grau); margin: 0; }
.ec-schluss { display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; margin-top: 1.2rem; }
.ec-textknopf { font: inherit; font-size: .82rem; border: 0; background: none; color: var(--akzent-dunkel); text-decoration: underline; cursor: pointer; padding: 0; }
.ec-zu { margin-left: auto; width: 2.2rem; height: 2.2rem; border-radius: 50%; border: 1px solid var(--grau-hell); background: #fff; cursor: pointer; font-size: .9rem; }

/* ------------------------------------------------ Dialoge */
.ec-dialog { border: 0; border-radius: var(--radius); box-shadow: var(--schatten); padding: 1.1rem 1.2rem; width: min(440px, 92vw); }
.ec-dialog::backdrop { background: rgba(11,35,52,.55); }
.ec-dialog h3 { margin: 0 0 .7rem; }
.ec-dialog input, .ec-dialog select { font: inherit; font-size: 1rem; width: 100%; border: 1px solid var(--grau-hell); border-radius: 8px; padding: .55rem .7rem; }
.ec-dialog-knoepfe { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1rem; }
.ec-bilddialog { width: min(980px, 96vw); padding: .6rem; }
.ec-bilddialog img { display: block; max-width: 100%; max-height: 80vh; margin: 0 auto; border-radius: 8px; }
.ec-bilddialog p { margin: .4rem .2rem 0; font-size: .85rem; color: var(--grau); }
.ec-bilddialog form { display: flex; justify-content: flex-end; }

/* ------------------------------------------------ Handy: der Chat füllt den Schirm */
@media (max-width: 899px) {
  /* Drei Spalten in einer Chat-Blase: die erste wurde 40 px schmal und brach "Arbeits-
     zimmer" buchstabenweise (Durchgang 08.10.). Untereinander liest es sich wie eine Liste. */
  .ec-angaben, .ec-angaben tbody, .ec-angaben tr, .ec-angaben td { display: block; }
  .ec-angaben tr { border-top: 1px solid var(--grau-hell); padding: .35rem 0; }
  .ec-angaben td { border-top: 0; padding: 0; }
  .ec-angaben td:first-child { font-size: .72rem; }
  .ec-angaben td:last-child:not(:empty) { margin-top: .15rem; }
  .ec-nur-klein { display: initial !important; }
  .ec-nur-gross { display: none !important; }
  .ec-seite .kopf { display: none; }
  .ec-seite .demo-band { font-size: .72rem; padding: .25rem .5rem; }
  .ec { display: block; width: 100%; margin: 0; height: auto; min-height: 0; }
  .ec-chat {
    border-radius: 0; box-shadow: none; border-top: 0; height: 100dvh; position: relative;
  }
  .ec-seite:has(.demo-band) .ec-chat { height: calc(100dvh - 26px); }
  .ec-chatkopf { padding: .5rem .8rem; gap: .55rem; }
  .ec-kopfknopf { padding: .35rem .7rem; font-size: .84rem; }
  #ec-link-klein { margin-left: auto; }
  .ec-erfasst-knopf { margin-left: 0; font-weight: 700; border: 2px solid var(--akzent); color: var(--akzent-dunkel); background: #fff; }
  .ec-chips { display: flex !important; gap: .35rem; padding: .45rem .8rem; overflow-x: auto; flex: none; border-bottom: 1px solid var(--grau-hell); background: #fff; scrollbar-width: none; }
  .ec-chip { flex: none; font-size: .8rem; border: 1px solid var(--grau-hell); border-radius: 999px; padding: .15rem .6rem; color: var(--grau); background: var(--creme); white-space: nowrap; }
  .ec-chip-ok { background: #E8F4EE; border-color: #B9DCC8; color: #23613F; }
  .ec-chip-offen { background: var(--warn-hell); border-color: #EBCF9F; color: #8A5A12; }
  .ec-verlauf { padding: .8rem .75rem .6rem; }
  .ec-verlauf > li { max-width: 92%; font-size: 1rem; }
  .ec-leiste { padding: .5rem .6rem calc(.5rem + env(safe-area-inset-bottom)); }
  .ec-zeile { gap: .35rem; }
  .ec-tipp { font-size: .72rem; }
  .ec-felder { grid-template-columns: 1fr; }
  .ec-erfassung {
    position: fixed; inset: 0; z-index: 40; border-radius: 0; transform: translateY(100%);
    transition: transform .25s ease; visibility: hidden;
  }
  .ec-erfasst-offen .ec-erfassung { transform: none; visibility: visible; }
  .ec-erfassung-inhalt { padding-bottom: calc(1.4rem + env(safe-area-inset-bottom)); }
}
@media (max-width: 380px) {
  .ec-rund, .ec-senden { width: 2.45rem; height: 2.45rem; }
  .ec-titel small { max-width: 30vw; }
}
@media (prefers-reduced-motion: reduce) {
  .ec-dreh, .ec-mikro.ec-an, .ec-rec { animation: none; }
  .ec-verlauf { scroll-behavior: auto; }
}
