/* ============================================================
   TEXTVORLAGEN – Karten mit Editor links, Vorschau rechts
   ============================================================ */
.tv-einleitung { display: flex; align-items: center; gap: 8px; margin: 14px 24px 6px; font-size: 13.5px; font-weight: 300; color: var(--ink-soft); }
.tv-einleitung .material-icons { font-size: 18px; color: var(--pal-gold-mittel, #c59556); }
.tv-einleitung code { padding: 1px 6px; border-radius: 6px; background: var(--neutral-100, #f2f1ee); font-family: inherit; font-size: 12.5px; color: var(--ink); }
.tv-hinweis { font-size: 13px; color: var(--pal-senf-dunkel, #6b5a1e); margin-right: 8px; }
/* Seite wie die Einstellungen: grauer Hintergrund, Titel oben, darunter die Reiter (.dialog-tabs) */
.tv-kopfzeile { align-items: flex-start; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.tv-kopfzeile > div:first-child { flex: 1 1 420px; min-width: 0; }
.tv-kopfzeile .text-muted { margin: 0; max-width: 640px; line-height: 1.5; }
.tv-aktionen { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.tv-aktionen .suchfeld-container { width: 240px; }
.tv-seite #status-area:not(:empty) { margin-bottom: 16px; padding: 0; background: none; }
.tv-seite #status-area .status { margin: 0; }
.tv-tabs { margin: 0 0 20px; }
.tv-tabs .tab-button.is-leer { opacity: .45; }
.tv-tabs .tv-geaendert-punkt { margin-left: 6px; vertical-align: 2px; }
.tv-tabs .tab-button.is-geaendert .tv-geaendert-punkt { display: inline-block; }
.tv-tab-zahl { margin-left: 6px; padding: 0 7px; border-radius: 10px; background: var(--paper, #fff); font-size: 11px; line-height: 18px; }
.tv-liste { display: flex; flex-direction: column; gap: 16px; padding: 0 0 40px; }
.stock-chip .material-icons { font-size: 15px; margin-right: 3px; vertical-align: -3px; }
.tv-gruppe { display: flex; flex-direction: column; gap: 16px; }
.tv-gruppe-titel { margin: 0; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-dark, var(--gold-mittel)); }

.tv-karte { position: relative; background: var(--paper, #fff); border: 1px solid var(--line, #e5e5e5); border-radius: 14px; padding: 18px 20px 20px; }
.tv-karte.is-geaendert { border-color: var(--pal-senf-mittel, #e5d7a5); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pal-senf-mittel, #e5d7a5) 40%, transparent); }
.tv-kopf { display: flex; align-items: center; justify-content: flex-start; gap: 12px; padding: 0; background: none; border: 0; }
.tv-kopf h3 { margin: 0; font-size: 17px; }
.tv-geaendert-punkt { display: none; width: 8px; height: 8px; border-radius: 50%; background: var(--gold, #e8c547); }
.tv-karte.is-geaendert .tv-geaendert-punkt { display: inline-block; }
.tv-kanal { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 7px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.tv-kanal .material-icons { font-size: 15px; }
.tv-k-mail.tv-kanal { background: var(--pal-blau-hell, #e6eef8); color: var(--pal-blau-dunkel, #1f4e89); }
.tv-k-wa.tv-kanal { background: var(--pal-gruen-hell, #e5f3e8); color: var(--pal-gruen, #2e7d32); }
.tv-k-pdf.tv-kanal { background: var(--pal-senf-hell, #f7f2e4); color: var(--pal-senf-dunkel, #6b5a1e); }
.tv-wo { display: flex; align-items: flex-start; gap: 6px; margin: 8px 0 14px; font-size: 13px; color: var(--ink-soft); }
.tv-wo .material-icons { font-size: 16px; margin-top: 1px; }

.tv-inhalt { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.tv-bearbeiten .field { margin-bottom: 12px; }
.tv-bearbeiten textarea { width: 100%; resize: vertical; line-height: 1.45; font-family: inherit; }
.tv-ph { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-soft); }
.tv-ph-knopf { padding: 3px 9px; border-radius: 999px; border: 1px dashed var(--line, #ccc); background: var(--surface, #f6f4ef); font: inherit; font-size: 12px; color: var(--ink); cursor: pointer; }
.tv-ph-knopf:hover { border-style: solid; border-color: var(--pal-senf-mittel, #e5d7a5); background: var(--pal-senf-hell, #f7f2e4); }
.tv-ph-knopf:disabled { opacity: .5; cursor: default; }

/* Vorschau */
.tv-vorschau { border-radius: 12px; padding: 16px; min-height: 100%; font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.tv-vorschau.tv-k-wa { background: #efeae2; }
.tv-vorschau.tv-k-mail { background: var(--surface, #f6f4ef); }
.tv-vorschau.tv-k-pdf { background: var(--surface, #f6f4ef); }
.tv-leer { margin: 0; color: var(--ink-soft); font-style: italic; white-space: normal; }
.tv-link { color: #1f6fb2; text-decoration: underline; }
.tv-wa-blase { position: relative; max-width: 92%; margin-left: auto; padding: 8px 12px 20px; background: #d9fdd3; border-radius: 10px 10px 2px 10px; color: #111; box-shadow: 0 1px 1px rgba(0,0,0,.08); }
.tv-wa-zeit { position: absolute; right: 10px; bottom: 4px; font-size: 11px; color: #667781; }
.tv-mail { background: #fff; border: 1px solid var(--line, #e5e5e5); border-radius: 10px; overflow: hidden; color: #222; }
.tv-mail-kopf { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-bottom: 1px solid var(--line, #eee); white-space: normal; }
.tv-mail-kopf small { color: var(--ink-soft); }
.tv-mail-text { padding: 12px 14px; }
.tv-pdf { background: #fff; border: 1px solid var(--line, #e5e5e5); border-radius: 4px; padding: 18px 20px; font-family: Georgia, "Times New Roman", serif; font-size: 13px; color: #222; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.tv-pdf-anrede { margin-bottom: 8px; }

@media (max-width: 860px) {
  .tv-inhalt { grid-template-columns: 1fr; }
  .tv-aktionen { width: 100%; flex-wrap: wrap; } .tv-aktionen .suchfeld-container { flex: 1 1 200px; width: auto; }
  .tv-einleitung { margin: 4px 12px 8px; }
}
body.dark-mode .tv-mail, body.dark-mode .tv-pdf { background: var(--nacht-800, #222); color: var(--ink); }
body.dark-mode .tv-vorschau.tv-k-wa { background: #0b141a; }
body.dark-mode .tv-wa-blase { background: #005c4b; color: #e9edef; }

/* Signatur */
.tv-sig-felder { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 14px; }
.tv-sig-felder input[type="color"] { width: 100%; height: 42px; padding: 3px; border-radius: 8px; }
.tv-sig-bild { display: flex; gap: 14px; align-items: center; padding: 12px 0; border-top: 1px dashed var(--line, #e5e5e5); }
.tv-sig-bild b { font-size: 14px; }
.tv-sig-bild .field-hint { margin: 2px 0 8px; }
.tv-sig-bildrahmen { flex: 0 0 96px; height: 96px; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--surface, #f6f4ef); overflow: hidden; }
.tv-sig-bildrahmen img { max-width: 100%; max-height: 100%; object-fit: contain; }
.tv-sig-bildrahmen span { font-size: 12px; color: var(--ink-soft); text-align: center; padding: 6px; }
.tv-karte[data-sig] .tv-inhalt { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); }
.tv-sig-frame { min-height: 520px; }
@media (max-width: 860px) { .tv-karte[data-sig] .tv-inhalt { grid-template-columns: 1fr; } }
/* Testmail-Knopf im Mailkopf der Vorschau */
.tv-mail-kopf { position: relative; }
.tv-mail-kopf .tv-testmail { position: absolute; top: 8px; right: 10px; height: 32px; padding: 0 10px; font-size: 13px; display: inline-flex; align-items: center; gap: 5px; }
.tv-mail-kopf .tv-testmail .material-icons { font-size: 16px; }
.tv-mail-kopf b, .tv-mail-kopf small { padding-right: 170px; }
@media (max-width: 600px) { .tv-mail-kopf .tv-testmail { position: static; align-self: flex-start; margin-top: 6px; } .tv-mail-kopf b, .tv-mail-kopf small { padding-right: 0; } }
