/* Einzelbeiträge: Liste, Editor, Ausschnitt (public/einzelpost-ui.js, docs/EINZELPOST-BAUPLAN.md Abschnitt 6).
   Eigene Datei statt style.css, damit das Modul seine Regeln an einer Stelle hat. Alle Klassen beginnen mit „ep-";
   die Hashtag-Vorschläge (public/hashtags-ui.js, Etappe 3) stehen am Ende mit „ht-".
   Farben nur über Klassen, Lage im Ausschnitt nur über SVG-Attribute (CSP, Bauplan 8.4). */

/* ---------------------------------------------------------------- Wochenplanung und Liste */

.ep-neu-tag {
  border-color: transparent;
  font-weight: 600;
  font-size: .95rem;
  position: relative;
}

.ep-neu-tag:hover {
  background: #f0eee6;
}

.ep-neu-zeile {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 15px;
  margin-bottom: 12px;
}

.ep-neu-knopf {
  min-height: 46px;
}

.ep-liste {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.ep-listeneintrag {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  font-weight: normal;
  padding: 10px 14px;
}

.ep-listenbild {
  flex: 0 0 56px;
  width: 56px;
  aspect-ratio: 4 / 5;
  border-radius: 6px;
  overflow: hidden;
  background: var(--ink);
  color: #f6f4ef;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ep-listenbild img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ep-listentext {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.ep-weiter {
  color: var(--muted);
  font-size: 1.2rem;
}

.ep-pill-hand {
  margin-left: 6px;
  background: #e4ece6;
  color: #124029;
}

/* ---------------------------------------------------------------- Editor: Kopf, Band, Aktionen */

.ep-kopf {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  margin-bottom: 14px;
}

.ep-kopf-felder {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  flex: 1 1 420px;
  min-width: 0;
}

.ep-titel {
  flex: 1 1 260px;
  min-width: 0;
  font-size: 1.25rem;
  font-weight: 700;
}

/* Datum und Speicherstand bleiben nebeneinander. */
.ep-kopf-zeile {
  display: flex;
  align-items: center;
  gap: 10px 18px;
  flex: 0 0 auto;
}

.ep-datum {
  flex: 0 0 170px;
  width: 170px;
}

.ep-stand {
  font-size: .875rem;
  color: var(--muted);
  white-space: nowrap;
}

.ep-unsichtbar {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  margin: 0;
}

.ep-band {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  z-index: 50;
  background: #a52624;
  color: #fff;
  padding: 12px 4vw;
  font-size: .95rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .2);
}

.ep-band[hidden] {
  display: none;
}

.ep-band button.text {
  color: #fff;
  text-decoration: underline;
  padding: 4px 6px;
}

.ep-aktionen {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px 20px;
  margin-bottom: 16px;
}

.ep-fehlt {
  flex: 1 1 320px;
  line-height: 1.5;
}

.ep-fehlt .error,
.ep-fehlt .muted {
  display: block;
}

.ep-knoepfe {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.ep-loeschen {
  color: #a52624;
}

.ep-hand {
  font-size: .875rem;
}

/* Nach der Übertragung: „Liegt bei Publer · Termin" mit Link. */
.ep-publer {
  font-size: .875rem;
  font-weight: 600;
}

.ep-publer a {
  font-weight: normal;
}

/* Nach einer nach dem Auftrag abgebrochenen Übertragung: „In Publer öffnen" neben „Liegt bei Publer". */
.ep-knoepfe > a {
  font-size: .875rem;
}

/* ---------------------------------------------------------------- Kartenleiste */

.ep-leiste-panel {
  padding: 14px 18px;
}

.ep-leiste {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.ep-leistenkarten {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  max-width: 100%;
  padding: 2px;
}

.ep-leistenkarte {
  position: relative;
  flex: 0 0 auto;
  width: 64px;
  aspect-ratio: 4 / 5;
  padding: 0;
  overflow: hidden;
  background: var(--ink);
  color: #f6f4ef;
  border: 3px solid transparent;
  border-radius: 8px;
}

.ep-leistenkarte:hover {
  background: #1b5538;
}

.ep-leistenkarte img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .55;
}

.ep-leistenkarte.ep-gewaehlt {
  border-color: var(--accent);
}

.ep-leistenzahl {
  position: absolute;
  left: 5px;
  bottom: 4px;
  font-size: .8rem;
  font-weight: 700;
}

.ep-warnzeichen {
  position: absolute;
  right: 3px;
  top: 2px;
  background: #fff1d1;
  color: #896214;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: .8rem;
  line-height: 22px;
  text-align: center;
}

/* Hinweis aus den Beitragsregeln (etwa „Karte 2 sollte eine Überschrift haben"), kein Fehler. */
.ep-regelzeichen {
  position: absolute;
  right: 3px;
  top: 2px;
  background: #e4ece6;
  color: #124029;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: .8rem;
  font-style: italic;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
}

.ep-plus {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ep-plus-foto {
  position: relative;
  font-weight: 600;
}

.ep-aus {
  display: none;
}

.ep-anzahl {
  margin-left: auto;
}

.ep-rueckgaengig {
  margin-top: 10px;
  font-size: .875rem;
}

.ep-rueckgaengig[hidden] {
  display: none;
}

/* Beitragsregeln für den ganzen Beitrag, unter der Kartenleiste. */
.ep-regeln {
  margin-top: 10px;
}

.ep-regeln:empty {
  display: none;
}

.ep-regeln-titel {
  margin: 0 0 4px;
  font-weight: 700;
}

.ep-rueckgaengig button {
  padding: 4px 6px;
  text-decoration: underline;
}

/* ---------------------------------------------------------------- Raster: Arbeit links, Vorschau rechts */

.ep-raster {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr);
  gap: 24px;
  align-items: start;
}

.ep-vorschau-spalte {
  position: sticky;
  top: 20px;
}

.ep-vorschau-panel {
  padding: 18px;
}

.ep-vorschau-rahmen {
  margin-top: 10px;
  aspect-ratio: 4 / 5;
  background: #e8e5dc;
  border-radius: 8px;
  overflow: hidden;
}

.ep-vorschau-rahmen img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ep-caption-vorschau {
  padding: 18px;
}

.ep-caption-text {
  white-space: pre-line;
  margin: 0;
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------- Karte bearbeiten */

.ep-karte-kopf {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.ep-karte-kopf h2 {
  margin: 0;
}

.ep-karte-knoepfe {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

textarea.ep-kurz {
  min-height: 0;
}

.ep-passform {
  margin: 6px 0 0;
  color: var(--muted);
}

.ep-passform.ep-passt-nicht {
  color: #a52624;
  font-weight: 600;
}

.ep-meldungen p {
  margin: 6px 0 0;
}

.ep-schalter {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 1rem;
  margin-bottom: 6px;
}

.ep-schalter input {
  width: 22px;
  height: 22px;
  margin: 0;
}

.ep-abschnitt {
  margin-top: 14px;
}

.ep-abschnitt > summary {
  cursor: pointer;
  font-weight: 700;
  min-height: 44px;
  display: flex;
  align-items: center;
}

details.panel.ep-abschnitt {
  margin-top: 0;
}

.ep-layouts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  margin: 8px 0;
}

.ep-layoutknopf,
.ep-wahl-knoepfe button {
  min-height: 44px;
}

.ep-layouts button[aria-pressed="true"],
.ep-wahl-knoepfe button[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.ep-wahl {
  margin: 14px 0;
}

.ep-wahl-name {
  display: block;
  font-size: .875rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.ep-wahl-knoepfe {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ep-farbknopf {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ep-farbfeld {
  display: inline-block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--line);
}

.ep-farbe-gruen {
  background: #124029;
}

.ep-farbe-gold {
  background: #c89b3d;
}

.ep-farbe-creme {
  background: #f6f4ef;
}

.ep-farbzeile {
  margin: 10px 0;
}

.ep-fotos {
  margin-top: 14px;
}

.ep-bildraster {
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  margin: 8px 0 10px;
}

.ep-foto-plus {
  position: relative;
  font-weight: 600;
}

.ep-ausschnitt {
  margin-top: 14px;
}

.ep-ausschnitt-svg {
  display: block;
  width: 100%;
  max-height: 520px;
  height: auto;
  background: #e8e5dc;
  border-radius: 8px;
  touch-action: none;
  cursor: crosshair;
  user-select: none;
}

.ep-ausschnitt-svg.ep-nur-lesen {
  touch-action: auto;
  cursor: default;
}

.ep-abdunkeln {
  fill: #000;
  fill-opacity: .45;
  pointer-events: none;
}

.ep-rahmen {
  fill: none;
  stroke: #c89b3d;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.ep-kopfzone {
  fill: #c89b3d;
  fill-opacity: .14;
  stroke: #f6f4ef;
  stroke-width: 2;
  stroke-dasharray: 6 4;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.ep-augen {
  fill: #c89b3d;
  stroke: #fff;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.ep-ziehpunkt {
  fill: #fff;
  stroke: #124029;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
  cursor: ns-resize;
}

.ep-zoom input[type="range"] {
  padding: 0;
  min-height: 44px;
  border: 0;
  background: transparent;
}

.ep-hinweis {
  border-left: 4px solid var(--accent);
  background: #fffaf0;
  padding: 8px 12px;
  border-radius: 4px;
}

.ep-hinweis[hidden] {
  display: none;
}

.ep-cta-zeile {
  color: var(--ink);
  font-weight: 600;
}

/* ---------------------------------------------------------------- Dialoge */

.ep-dialog-bilder {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 14px;
}

.ep-dialog-bilder figure {
  margin: 0;
  width: 72px;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: 6px;
}

.ep-dialog-bilder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ep-dialog .transfer-confirm {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 10px 0;
  font-weight: normal;
}

.ep-dialog .transfer-confirm input {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  margin: 0;
}

/* Übertragungsdialog (Etappe 2): jede Karte klein mit „Karte n" darunter; Textkarten als grüne Fläche. */
.ep-uebertragen-karten figure {
  aspect-ratio: auto;
  overflow: visible;
}

.ep-uebertragen-karten img,
.ep-uebertragen-textkarte {
  display: block;
  width: 72px;
  height: 90px;
  border-radius: 6px;
}

.ep-uebertragen-karten img {
  object-fit: cover;
}

.ep-uebertragen-textkarte {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  background: #124029;
  color: #F6F4EF;
  font-size: .7rem;
  font-weight: 600;
  text-align: center;
}

.ep-uebertragen-karten figcaption {
  margin-top: 4px;
  font-size: .75rem;
  color: var(--muted);
}

/* Die letzte Übertragung brach nach dem Auftrag ab (Prüfbefund 8): alter Fehler, Link nach Publer, Pflicht-Haken. */
.ep-nachsehen {
  margin: 10px 0 14px;
}

.ep-nachsehen p {
  margin-bottom: 6px;
}

.ep-nachsehen .transfer-confirm {
  margin-bottom: 0;
}

/* Wahl der ersten Karte („＋ Neuer Beitrag"): zwei große Flächen nebeneinander, am Handy untereinander. */
.ep-neu-wahl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0 6px;
}

.ep-neu-option {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  min-height: 120px;
  margin: 0;
  padding: 18px;
  text-align: left;
  font-size: 1rem;
  font-weight: 600;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}

.ep-neu-option:hover {
  background: #f0eee6;
  border-color: var(--accent);
}

.ep-neu-option strong {
  font-size: 1.1rem;
}

.ep-neu-option .small {
  font-weight: normal;
  line-height: 1.5;
}

.ep-neu-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.ep-neu-option:focus-within {
  outline: 2px solid var(--ink);
}

.ep-neu-laeuft .ep-neu-option {
  cursor: wait;
  opacity: .55;
}

/* ---------------------------------------------------------------- Nur lesen */

.ep-gesperrt .ep-ausschnitt-svg {
  cursor: default;
}

/* ---------------------------------------------------------------- Feste Leiste unten (nur am Handy) */

.ep-fussleiste {
  display: none;
}

@media (max-width: 900px) {
  .ep-raster {
    grid-template-columns: minmax(0, 1fr);
  }

  .ep-neu-wahl {
    grid-template-columns: minmax(0, 1fr);
  }

  .ep-neu-option {
    min-height: 0;
  }

  /* Am Handy steht die Kartenvorschau oben (Bauplan 6.4), die Caption-Vorschau unter den Feldern. */
  .ep-vorschau-spalte {
    display: contents;
  }

  .ep-vorschau-panel {
    order: -1;
  }

  .ep-caption-vorschau {
    order: 2;
  }

  .ep-vorschau-panel .ep-vorschau-rahmen {
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
  }

  .ep-editor {
    padding-bottom: 84px;
  }

  .ep-editor button,
  .ep-editor .upload-label {
    min-height: 44px;
  }

  .ep-leistenkarten {
    flex-wrap: nowrap;
  }

  .ep-anzahl {
    margin-left: 0;
  }

  .ep-fussleiste {
    display: flex;
    gap: 10px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    padding: 10px 16px;
    background: #fff;
    border-top: 1px solid var(--line);
    box-shadow: 0 -4px 16px rgba(18, 64, 41, .12);
  }

  .ep-fussleiste button {
    flex: 1;
    min-height: 48px;
  }

  /* Solange ein Textfeld den Fokus hat, verdeckt die Leiste nichts über der Tastatur. */
  .ep-editor.ep-tippt .ep-fussleiste {
    display: none;
  }

  /* Toasts über der festen Fußleiste (Prüfbefund 9): sonst verdeckt sie die Rückmeldung, auch die zur Übertragung. */
  body:has(.ep-fussleiste) #toast {
    bottom: calc(85px + env(safe-area-inset-bottom));
    z-index: 60;
  }

  /* Kopf am Handy untereinander: Zurück, darunter der Titel in voller Breite, darunter Datum und Speicherstand. */
  .ep-kopf {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .ep-kopf #ep-zurueck {
    align-self: flex-start;
  }

  .ep-kopf-felder {
    flex-direction: column;
    align-items: stretch;
    flex: none;
    width: 100%;
  }

  .ep-titel {
    flex: none;
    width: 100%;
  }

  .ep-kopf-zeile {
    width: 100%;
  }

  .ep-datum {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
  }
}

/* ---------------------------------------------------------------- Hashtag-Vorschläge (public/hashtags-ui.js, Bauplan 9.2) */

.ht-bereich {
  margin-top: 12px;
}

.ht-knopfzeile {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.ht-knopf {
  min-height: 44px;
}

.ht-zeile {
  margin: 8px 0 0;
  line-height: 1.5;
}

.ht-zeile[hidden] {
  display: none;
}

.ht-fehler {
  color: #a52624;
}

.ht-ergebnis:empty {
  display: none;
}

.ht-ergebnis {
  margin-top: 12px;
}

.ht-titel {
  font-size: .875rem;
  margin: 14px 0 6px;
}

.ht-zeilen {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.ht-eintrag {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

/* Steht der Tag im Feld, ist die Zeile goldgerahmt; sonst wartet sie mit „＋". */
.ht-im-feld {
  border-color: var(--accent);
  background: #fffaf0;
}

.ht-inhalt {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-wrap: anywhere;
}

.ht-tag {
  font-weight: 700;
}

.ht-weg,
.ht-dazu {
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  padding: 6px 10px;
  font-size: 1.1rem;
  line-height: 1;
}

.ht-im-text {
  flex: 0 0 auto;
  align-self: center;
}

.ht-platz {
  margin: 10px 0 0;
  border-left: 4px solid var(--accent);
  background: #fffaf0;
  padding: 6px 10px;
  border-radius: 4px;
}

.ht-meldung {
  margin: 10px 0 0;
}

.ht-aussortiert {
  margin: 12px 0 0;
  font-size: .8rem;
  overflow-wrap: anywhere;
}

/* „Feste Hashtags" auf „Marke & Bildregeln", außerhalb des Markenformulars (Bauplan 9.4). */
.ht-vorgaben {
  max-width: 830px;
}

.ht-vorgaben h2 {
  margin-bottom: 8px;
}

.ht-vorgaben-felder {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.ht-vorgaben-felder .field {
  margin-bottom: 14px;
}

.ht-vorgaben-fuss {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.ht-vorgaben-fuss .ht-zeile {
  margin: 0;
}

@media (max-width: 760px) {
  .ht-vorgaben-felder {
    grid-template-columns: 1fr;
    gap: 0;
  }
}
