/* Antwort-Stapel ib baumgartner (Etappe 3a). Farbwelt und Bausteine aus buerosystem/stil.css und dem
   Mockup abgeleitet; eigenes, schlankes CSS ohne Framework, ohne CDN. Kein Inline-Style im HTML (CSP). */
:root {
  --bg: #f6f7f8; --karte: #fff; --linie: #d9dde1; --ink: #1a2029;
  --gedimmt: #5b6673; --akzent: #0a7565; --akzent-hell: #e6f2ef;
  --warn-bg: #fdf1e7; --warn-ink: #8a4d12; --fehler-bg: #fbe9e9; --fehler-ink: #8a1f1f;
  --ok-bg: #e8f3e8; --ok-ink: #1f6b2a; --gelb-bg: #fdf7e7; --gelb-rand: #e0c063;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Arial, sans-serif; }
a { color: var(--akzent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }

/* Kopf: eine Zeile, die Marke ist zugleich der Link zum Stapel */
.kopf { background: var(--ink); color: #fff; }
.kopf-inner { max-width: 1100px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 48px; }
.marke { font-size: 17px; color: #fff; display: inline-flex; align-items: center; gap: 8px; padding: 12px 0; }
a.marke:hover { text-decoration: none; }
.marke small { color: #b8c1cc; font-size: 15px; }
.kopf .zahl { background: #4fb3a2; color: var(--ink); border-radius: 9px; padding: 0 6px;
  font-size: 12px; font-weight: 700; }
.kopf-menue { margin-left: auto; }
.kopf-menue a { color: #c9d1da; font-size: 14px; padding: 13px 4px; display: inline-block; }
.kopf-menue a:hover { color: #fff; }
.abmelden { margin: 0; }
.abmelden button { background: none; border: 0; color: #c9d1da; font: inherit; font-size: 14px;
  padding: 13px 4px; cursor: pointer; }
.abmelden button:hover { color: #fff; text-decoration: underline; }

/* Layout und Bausteine */
.inhalt { max-width: 1100px; margin: 0 auto; padding: 20px 20px 60px; }
h1 { font-size: 21px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 10px; }
.untertitel { color: var(--gedimmt); margin: 0 0 16px; font-size: 14px; }
.karte { background: var(--karte); border: 1px solid var(--linie); border-radius: 8px; padding: 16px;
  margin-bottom: 16px; }
.karte.eng { padding: 4px 12px; }
.hinweis { color: var(--gedimmt); font-size: 13px; }
.meldung { padding: 9px 12px; border-radius: 6px; font-size: 14px; margin: 0 0 12px; }
.meldung.warnung { background: var(--warn-bg); color: var(--warn-ink); border-left: 3px solid var(--warn-ink); }
.meldung.fehler { background: var(--fehler-bg); color: var(--fehler-ink); border-left: 3px solid var(--fehler-ink); }
.meldung.ok { background: var(--ok-bg); color: var(--ok-ink); border-left: 3px solid var(--ok-ink); }
.meldung.info { background: #eef1f3; color: var(--gedimmt); border-left: 3px solid #9aa5b1; }
.meldung .klein { display: block; font-size: 12px; margin-top: 4px; }
/* "Der Entwurf ist fertig." / "Ihr Text wurde ersetzt." (O1): Satz und Knopf in einer Zeile, am Handy darunter */
#ki-fertig { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; }
.hinweiskasten { background: var(--gelb-bg); border: 1px solid var(--gelb-rand); border-radius: 6px;
  padding: 9px 12px; font-size: 14px; margin: 0 0 12px; }
.hinweiskasten strong { display: block; margin-bottom: 2px; }
.hinweiskasten ul { margin: 0; padding-left: 18px; }

.knopf { display: inline-block; background: var(--akzent); color: #fff; border: 0; border-radius: 6px;
  padding: 8px 15px; font: inherit; font-size: 14px; cursor: pointer; }
.knopf:hover { background: #086054; text-decoration: none; }
.knopf:disabled { background: #b9c2c9; cursor: not-allowed; }
.knopf.sekundaer { background: #eef1f3; color: var(--ink); }
.knopf.sekundaer:hover { background: #e2e6ea; }
.knopf.sekundaer:disabled { background: #f3f5f6; color: #9aa4ad; cursor: not-allowed; }
.marker { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; white-space: nowrap; }
.marker.neutral { background: #eef1f3; color: var(--gedimmt); }
.marker.ok { background: var(--ok-bg); color: var(--ok-ink); }
.marker.warn { background: var(--warn-bg); color: var(--warn-ink); }
.marker.rot { background: var(--fehler-bg); color: var(--fehler-ink); }

/* Anmeldung */
.anmeldung { max-width: 380px; margin: 40px auto 0; }
.anmeldung label { display: block; color: var(--gedimmt); font-size: 13px; margin: 0 0 4px; }
.anmeldung input[type="password"] { font: inherit; font-size: 16px; padding: 9px 10px; width: 100%;
  border: 1px solid var(--linie); border-radius: 6px; margin: 0 0 14px; }
.anmeldung .knopf { width: 100%; padding: 10px 15px; }
.unsichtbar { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Stapel */
.stapel-kopf { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.filter { display: inline-flex; border: 1px solid var(--linie); border-radius: 8px; overflow: hidden;
  margin: 0 0 14px; background: #fff; }
.filter a { font-size: 14px; padding: 7px 14px; color: var(--gedimmt); border-right: 1px solid var(--linie); }
.filter a:last-child { border-right: 0; }
.filter a:hover { text-decoration: none; background: #f6f7f8; }
.filter a.aktiv { background: var(--akzent); color: #fff; }
.stapel-eintrag { display: flex; gap: 12px; align-items: flex-start; padding: 12px 4px;
  border-bottom: 1px solid #eef1f3; color: inherit; position: relative; }
.stapel-eintrag:last-child { border-bottom: 0; }
.stapel-eintrag:hover { background: #fafbfc; }
.stapel-eintrag:hover .titel { color: var(--akzent); }
/* Der Titel-Link deckt den ganzen Eintrag ab; "Rueckgaengig" liegt darueber */
.stapel-link { color: var(--ink); display: block; }
.stapel-link:hover { text-decoration: none; }
.stapel-link::after { content: ""; position: absolute; inset: 0; }
.stapel-link:focus-visible { outline: none; }
.stapel-link:focus-visible::after { outline: 2px solid var(--akzent); outline-offset: -2px; border-radius: 6px; }
.stapel-rechts .rueckgaengig, .stapel-rechts .versand-hinweis { position: relative; z-index: 1; }
.stapel-punkt { flex: 0 0 10px; height: 10px; border-radius: 50%; margin-top: 7px; background: var(--akzent); }
.stapel-punkt.verschickt { background: #9cc8a4; }
.stapel-punkt.erledigt { background: #c3cad1; }
.stapel-text { flex: 1; min-width: 0; }
.stapel-text .titel { font-weight: 600; overflow-wrap: anywhere; }
.stapel-text p { margin: 2px 0 0; font-size: 13px; color: var(--gedimmt); overflow-wrap: anywhere; }
.leise { color: var(--gedimmt); font-size: 12px; }
.stapel-rechts { text-align: right; font-size: 12px; color: var(--gedimmt); white-space: nowrap;
  display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.mehr { display: flex; justify-content: space-between; font-size: 14px; margin: 0 0 16px; }

/* Entwurfsansicht */
.pfad { font-size: 13px; color: var(--gedimmt); margin: 0 0 10px; display: flex;
  justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.zweispaltig { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.umschalter { display: none; }
.feld { display: grid; grid-template-columns: 70px 1fr; gap: 8px; align-items: center; margin: 0 0 8px; font-size: 14px; }
.feld label { color: var(--gedimmt); font-size: 13px; }
.feld input { font: inherit; font-size: 14px; padding: 6px 8px; border: 1px solid var(--linie);
  border-radius: 6px; width: 100%; background: #f6f7f8; color: var(--ink); }
.feld input:not([readonly]) { background: #fff; }
.feld:has([data-zustand="fehlt"], [data-zustand="pruefen"], [data-zustand="ungueltig"]) input {
  border-color: var(--gelb-rand); background: var(--gelb-bg); }
.feld-zusatz { grid-column: 2; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: -4px; }
.feld-hinweis { font-size: 12px; color: var(--warn-ink); }
.feld-hinweis[data-zustand="ok"] .adress-zustand { display: none; }
.feld-hinweis .adress-technisch, .feld-hinweis .adress-mischschrift, .feld-hinweis .adress-buero { display: block; }
.feld-hinweis .adress-technisch { color: var(--gedimmt); }
.feld-hinweis .adress-technisch code { font: inherit; color: var(--ink); overflow-wrap: anywhere; }
.feld-hinweis .adress-mischschrift { color: var(--fehler-ink); font-weight: 600; }
/* bestaetigt: nichts mehr zu sagen, ausser wohin die Mail technisch geht oder dass Schriften gemischt sind (K-R2-3) */
.feld-zusatz:has([data-zustand="ok"]):not(:has(.adress-technisch)):not(:has(.adress-mischschrift)):not(:has(.adress-buero)) { display: none; }
#adresse-stimmt { display: none; }
.feld:has([data-zustand="pruefen"]) #adresse-stimmt { display: inline-block; }
.knopf.klein { padding: 3px 10px; font-size: 12px; }
.entwurf-text { display: block; width: 100%; border: 1px solid var(--linie); border-radius: 6px;
  padding: 12px 14px; font: inherit; font-size: 14px; line-height: 1.55; background: #f6f7f8;
  color: var(--ink); resize: vertical; field-sizing: content; min-height: 8em; }
.entwurf-text:not([readonly]) { background: #fff; }
.entwurf-text.leer { background: var(--gelb-bg); border-color: var(--gelb-rand); }
.speicherzeile { min-height: 20px; margin: 4px 0 0; font-size: 12px; color: var(--gedimmt); }
.speicherstatus.fehler { color: var(--fehler-ink); font-size: 13px; }
.speicherstatus.ok { color: var(--ok-ink); }
.platzhalter:empty { display: none; }
.platzhalter { margin: 8px 0 0; font-size: 13px; color: var(--gedimmt); display: flex; flex-wrap: wrap;
  align-items: center; gap: 6px; }
.platzhalter-knopf { font: inherit; font-size: 13px; background: var(--gelb-bg); color: var(--warn-ink);
  border: 1px solid var(--gelb-rand); border-radius: 12px; padding: 2px 10px; cursor: pointer; }
.platzhalter-knopf:hover { background: #fbefc9; }
.speicherstatus .knopf { margin-left: 4px; }
.aktionen { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; border-top: 1px solid #eef1f3;
  padding-top: 12px; margin-top: 14px; }
.aktionen form.inline { margin: 0; }
.aktionen a.knopf { text-decoration: none; }
details.rueckruf[open] { flex: 1 1 100%; }
details.rueckruf > summary { list-style: none; cursor: pointer; display: inline-block; }
details.rueckruf > summary::-webkit-details-marker { display: none; }
details.rueckruf p { margin: 10px 0 0; font-size: 14px; }
.gespraech dl { margin: 0; display: grid; grid-template-columns: 100px 1fr; gap: 5px 10px; font-size: 14px; }
.gespraech dt { color: var(--gedimmt); font-size: 13px; }
.gespraech dd { margin: 0; overflow-wrap: anywhere; }
/* Plan AK (6): der Grund einer verworfenen Adresse ist laenger als „nicht genannt“, er bricht in der Spalte um */
.gespraech dd .marker { white-space: normal; }
.gespraech ul { margin: 4px 0 0; padding-left: 18px; font-size: 14px; }
.gespraech .zwischen { margin: 12px 0 0; }
.transkript { font: inherit; font-size: 13px; margin: 8px 0 0; border-top: 1px solid #eef1f3;
  padding-top: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.transkript.dialog { white-space: normal; }
.zug { margin: 0 0 6px; }
.zug b { font-weight: 600; color: var(--gedimmt); }
.zug.anrufer { padding-left: 0; }
.zug.assistent { color: var(--gedimmt); padding-left: 12px; border-left: 2px solid #d9dde1; }
.zug.anrufer b { color: var(--akzent); }
.zug { white-space: pre-wrap; overflow-wrap: anywhere; }
/* Signatur, Sendehindernisse, Senden (3c) */
.signatur-anzeige { font: inherit; font-size: 14px; line-height: 1.55; color: var(--gedimmt);
  margin: 10px 0 0; padding: 0 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.signatur-anzeige.fehlt { color: var(--warn-ink); font-size: 13px; padding: 0; }
.sendehinweis[data-gesperrt="0"] { display: none; }
.sendehinweis { background: var(--warn-bg); color: var(--warn-ink); border-radius: 6px; padding: 9px 12px;
  font-size: 13px; margin: 12px 0 0; }
.sendehinweis ul { margin: 2px 0 0; padding-left: 18px; }
.sendehinweis a { display: inline-block; margin-top: 4px; }
.sendeleiste { display: flex; gap: 8px; }
.sendeleiste .knopf { min-width: 120px; text-align: center; }
#senden:disabled { background: #b9c2c9; }
.versand-hinweis { font-size: 12px; color: var(--fehler-ink); white-space: normal; }

/* Versand-Leiste: Restzeit und Rueckgaengig, auf jeder Seite unten (wie der Toast im Mockup) */
.versandleiste { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 20;
  display: flex; flex-direction: column; gap: 8px; width: max-content; max-width: calc(100% - 32px); }
.versand-zeile { background: var(--ink); color: #fff; border-radius: 8px; padding: 10px 14px; font-size: 14px;
  display: flex; gap: 14px; align-items: center; box-shadow: 0 4px 14px rgba(0,0,0,.2); flex-wrap: wrap; }
.versand-zeile .knopf { background: none; border: 1px solid #8fa0b0; color: #fff; padding: 4px 12px;
  font-size: 13px; }
.versand-zeile .knopf:hover { background: #2c3644; }
.versand-zeile .knopf.weiter { background: var(--akzent); border-color: var(--akzent); }
.versand-zeile .ansehen { color: #8fd3c6; }
.versand-zeile .versand-hinweis { color: #ffd2d2; }
.versand-zeile.fehlgeschlagen, .versand-zeile.unklar { background: var(--fehler-ink); }
.versand-zeile.abgebrochen { background: var(--warn-ink); }
.versand-zeile.gesendet { background: var(--ok-ink); }
.versand-text .rest { font-variant-numeric: tabular-nums; }

/* Einstellungen */
.einstellung-karte h3 { font-size: 14px; margin: 18px 0 6px; color: var(--gedimmt); font-weight: 600; }
.signatur-form textarea { display: block; width: 100%; font: inherit; font-size: 14px; line-height: 1.55;
  border: 1px solid var(--linie); border-radius: 6px; padding: 10px 12px; resize: vertical; }
.signatur-zeile { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 8px 0 0;
  flex-wrap: wrap; }
.signatur-vorschau { font: inherit; font-size: 14px; line-height: 1.55; background: #f6f7f8; border-radius: 6px;
  padding: 10px 14px; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.signatur-vorschau .platzhalter-text { color: var(--gedimmt); font-style: italic; }

details.aufklapp > summary { cursor: pointer; color: var(--akzent); font-size: 14px; margin-top: 12px; }
.sammel-form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 12px 0 0; }
.geltung { display: inline-flex; border: 1px solid var(--linie); border-radius: 8px; overflow: hidden; margin: 0;
  padding: 0; }
.geltung label { font-size: 14px; padding: 7px 14px; color: var(--gedimmt); cursor: pointer;
  border-right: 1px solid var(--linie); }
.geltung label:last-child { border-right: 0; }
.geltung input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.geltung label:has(input:checked) { background: var(--akzent); color: #fff; }
.geltung label:has(input:focus-visible) { outline: 2px solid var(--akzent); outline-offset: -2px; }
.sammel-form select, .passwort-form input { font: inherit; font-size: 14px; padding: 7px 10px;
  border: 1px solid var(--linie); border-radius: 6px; background: #fff; color: var(--ink); }
.zustand { margin: 0; font-size: 14px; }
.zustand .marker { margin-right: 6px; }
.einstellung-karte details .meldung { margin: 10px 0; }
.geraete { list-style: none; margin: 10px 0 12px; padding: 0; }
.geraet { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0;
  border-bottom: 1px solid #eef1f3; }
.geraet:last-child { border-bottom: 0; }
.geraet form { margin: 0; }
.passwort-form { display: grid; gap: 8px; max-width: 420px; margin: 12px 0 0; }
.passwort-form label { color: var(--gedimmt); font-size: 13px; }
.passwort-form .knopf { justify-self: start; }
.passwort-anzeige { display: block; font: 600 20px/1.4 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background: var(--akzent-hell); border: 1px solid var(--akzent); border-radius: 6px; padding: 14px 16px;
  overflow-wrap: anywhere; user-select: all; letter-spacing: 0.5px; }
.aktivieren-meldung .meldung { margin: 0; }
.abbrechen-form { margin: 14px 0 0; }
#passwort-neu h2 { margin-top: 22px; }
#passwort-neu h2:first-child { margin-top: 0; }

/* Handy */
@media (max-width: 760px) {
  .inhalt { padding: 14px 16px 60px; }
  body:has(.sendeleiste) .inhalt { padding-bottom: 150px; }
  .kopf-menue a { padding: 12px 6px; }
  /* Senden (bzw. Weiter) als feste Leiste unten in voller Breite */
  .sendeleiste { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; padding: 10px 16px;
    background: #fff; border-top: 1px solid var(--linie); z-index: 10; }
  .sendeleiste .knopf, .sendeleiste form.inline, .sendeleiste form.inline .knopf { width: 100%; flex: 1; }
  .versandleiste { left: 16px; right: 16px; transform: none; width: auto; max-width: none; bottom: 16px; }
  body:has(.sendeleiste) .versandleiste { bottom: 76px; }
  .versand-zeile .knopf.weiter { display: none; }
  .kopf-inner { padding: 0 16px; }
  .marke small { display: none; }
  .abmelden button { padding: 12px 4px; }
  .zweispaltig { grid-template-columns: 1fr; }
  .js .umschalter { display: flex; border: 1px solid var(--linie); border-radius: 8px; overflow: hidden;
    margin: 0 0 12px; background: #fff; }
  .umschalter button { flex: 1; border: 0; background: #fff; font: inherit; font-size: 14px; padding: 10px 8px;
    cursor: pointer; color: var(--gedimmt); }
  .umschalter button.aktiv { background: var(--akzent); color: #fff; }
  .js .zweispaltig[data-handy="entwurf"] .spalte-gespraech { display: none; }
  .js .zweispaltig[data-handy="gespraech"] .spalte-entwurf { display: none; }
  .feld { grid-template-columns: 1fr; gap: 3px; }
  .feld-zusatz { grid-column: 1; margin-top: 0; }
  .gespraech dl { grid-template-columns: 1fr; gap: 0; }
  .gespraech dd { margin-bottom: 6px; }
  .filter { display: flex; }
  .filter a { flex: 1; text-align: center; padding: 10px 6px; }
  .stapel-eintrag { flex-wrap: wrap; }
  .stapel-rechts { flex-direction: row; flex-wrap: wrap; justify-content: flex-start; white-space: normal;
    flex: 1 0 100%; text-align: left; padding-left: 22px; }
  .stapel-kopf .knopf { width: 100%; text-align: center; padding: 11px 15px; margin-bottom: 12px; }
  .aktionen { flex-direction: column; align-items: stretch; }
  .aktionen .knopf, .aktionen form.inline .knopf { width: 100%; text-align: center; padding: 11px 15px; }
  .knopf.klein { padding: 6px 12px; }
  .sammel-form .knopf { width: 100%; text-align: center; padding: 11px 15px; }
  .passwort-form { max-width: none; }
  .passwort-form .knopf { justify-self: stretch; padding: 11px 15px; }
  .passwort-anzeige { font-size: 17px; }
  .abbrechen-form .knopf { width: 100%; text-align: center; padding: 11px 15px; }
}
