/* Immo-Projekt – schlankes, eigenstaendiges Stylesheet (kein CDN, NAS-tauglich) */
:root {
  --bg: #f1f4f3; --card: #ffffff; --ink: #16211d; --muted: #6a7a75;
  --line: #e3e9e6; --line-2: #eef2f0;
  --brand: #2f6f4f; --brand-d: #245740; --brand-soft: #eaf3ee; --brand-ink: #1d4a36;
  --pos: #1f8a4c; --neg: #c0392b; --warn: #b7791f; --accent: #2d5f8a;
  --pos-soft: #e6f4ec; --neg-soft: #fbecea; --warn-soft: #fdf4e3;
  --r: 12px; --r-sm: 8px;
  --sh-1: 0 1px 2px rgba(16,40,32,.05);
  --sh-2: 0 2px 8px rgba(16,40,32,.07);
  --sh-3: 0 6px 18px rgba(16,40,32,.10);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", system-ui, Arial, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* ---- Layout mit linker Seitenleiste ---- */
.layout { display: flex; align-items: stretch; min-height: 100vh; }

.sidebar { flex: 0 0 232px; width: 232px; background: #fff;
  border-right: 1px solid var(--line); box-shadow: 1px 0 8px rgba(15,40,30,.04);
  position: sticky; top: 0; align-self: flex-start; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; }
/* Logo-Kopfbereich – Logo bleibt wie zuvor: links oben, 34px hoch */
.sidebar .brand { display: flex; align-items: center; height: 62px;
  padding: 0 18px; border-bottom: 1px solid var(--line); }
.sidebar .brand img { height: 34px; width: auto; max-width: 100%; display: block; }
.sidebar .brand:hover { text-decoration: none; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; padding: 14px 10px; }
.sidebar nav a { color: var(--ink); font-weight: 500; font-size: 14.5px;
  padding: 9px 12px; border-radius: var(--r-sm); line-height: 1.2;
  transition: background .13s, color .13s; }
.sidebar nav a:hover { background: var(--brand-soft); color: var(--brand-ink); text-decoration: none; }
.sidebar nav a.active { background: var(--brand); color: #fff; font-weight: 600;
  box-shadow: var(--sh-1); }
.sidebar nav a.active:hover { background: var(--brand-d); color: #fff; }
.sidebar nav a.sub { margin-left: 12px; padding-left: 12px; font-size: 13.5px;
  color: var(--muted); border-left: 2px solid var(--line); border-radius: 0 8px 8px 0; }
.sidebar nav a.sub:hover { border-left-color: var(--brand); }
.sidebar nav a.sub.active { color: #fff; border-left-color: var(--brand-d); }
.side-user { margin-top: auto; padding: 12px 18px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-user .navuser { color: var(--muted); font-weight: 600; font-size: 14px; }

main { flex: 1 1 auto; min-width: 0; max-width: 1120px; margin: 26px auto;
  padding: 0 26px; width: 100%; }

@media (max-width: 820px) {
  .layout { flex-direction: column; }
  .sidebar { position: static; height: auto; width: 100%; flex-basis: auto;
    border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar .brand { border-bottom: 1px solid var(--line); }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar nav a.sub { margin-left: 0; border-left: 0; }
  main { margin: 18px auto; padding: 0 16px; }
}
h1 { font-size: 25px; margin: 0 0 18px; letter-spacing: -.2px; font-weight: 700; }
h2 { font-size: 18px; margin: 28px 0 12px; letter-spacing: -.1px; font-weight: 650; }
h3 { font-size: 16px; margin: 18px 0 8px; font-weight: 600; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 18px 20px; margin-bottom: 18px; box-shadow: var(--sh-1); }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 17px 16px; text-align: center; box-shadow: var(--sh-1); }
.kpi .val { font-size: 26px; font-weight: 700; letter-spacing: -.4px;
  font-variant-numeric: tabular-nums; }
.kpi .lbl { color: var(--muted); font-size: 12.5px; margin-top: 5px;
  letter-spacing: .2px; }
.pos { color: var(--pos); } .neg { color: var(--neg); }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left;
  vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase;
  letter-spacing: .5px; font-weight: 650; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:hover td { background: #f7faf9; }
.table-wrap { overflow-x: auto; }

label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea { width: 100%; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: var(--r-sm); font: inherit; background: #fff; color: var(--ink);
  transition: border-color .13s, box-shadow .13s; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47,111,79,.13); }
textarea { min-height: 90px; resize: vertical; }
.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > * { flex: 1 1 160px; }
.inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: auto; }

.btn { display: inline-block; background: var(--brand); color: #fff; border: 0;
  padding: 9px 16px; border-radius: var(--r-sm); font: inherit; font-weight: 550;
  cursor: pointer; box-shadow: var(--sh-1); transition: background .13s, box-shadow .13s; }
.btn:hover { background: var(--brand-d); text-decoration: none; box-shadow: var(--sh-2); }
.btn.sec { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.sec:hover { background: var(--brand-soft); border-color: #cfe0d6; color: var(--brand-ink); }
.btn.danger { background: #fff; color: var(--neg); border: 1px solid #e6c3bd; }
.btn.danger:hover { background: var(--neg-soft); }
.btn.sm { padding: 5px 11px; font-size: 13px; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 12px;
  font-weight: 550; background: var(--line-2); color: var(--muted); }
.badge.on { background: var(--pos-soft); color: var(--pos); }
.badge.off { background: var(--neg-soft); color: var(--neg); }

.muted { color: var(--muted); }
.right { text-align: right; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.hint { background: var(--brand-soft); border-left: 3px solid var(--brand); padding: 11px 14px;
  border-radius: var(--r-sm); font-size: 14px; color: #315448; }
.error { background: var(--neg-soft); border-left: 3px solid var(--neg); padding: 11px 14px;
  border-radius: var(--r-sm); color: #922; margin-bottom: 14px; }

.crumbs { font-size: 14px; margin-bottom: 12px; }
.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 24px; }

/* ============ Startseite (Uebersicht) ============ */
.pagehead { display: flex; align-items: flex-start; justify-content: space-between;
  gap: 18px; flex-wrap: wrap; margin-bottom: 20px; }
.pagehead h1 { margin: 0 0 3px; }
.pagehead-sub { color: var(--muted); font-size: 14px; }

.quickbar { display: flex; gap: 8px; flex-wrap: wrap; }
.qa { display: inline-flex; align-items: center; gap: 7px; background: #fff;
  border: 1px solid var(--line); border-radius: 22px; padding: 8px 15px;
  color: var(--ink); font-size: 14px; font-weight: 550; box-shadow: var(--sh-1);
  transition: background .13s, border-color .13s, box-shadow .13s, transform .13s; }
.qa:hover { text-decoration: none; background: var(--brand-soft); border-color: #cfe0d6;
  color: var(--brand-ink); box-shadow: var(--sh-2); transform: translateY(-1px); }
.qa-ico { font-size: 15px; line-height: 1; }

.saldocard { display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; }
.saldo { font-size: 22px; margin-left: 8px; font-variant-numeric: tabular-nums;
  letter-spacing: -.3px; }

/* Zu erledigen */
.todo { padding-bottom: 8px; }
.todo-head { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; }
.todo-head h2 { margin: 0; display: flex; align-items: center; gap: 9px; }
.todo-head .count { display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 24px; padding: 0 7px; border-radius: 20px;
  background: var(--line-2); color: var(--muted); font-size: 13px; font-weight: 700; }
.todo-head .count.urgent { background: var(--neg-soft); color: var(--neg); }

.todolist { list-style: none; margin: 14px 0 0; padding: 0; }
.todoitem { display: flex; align-items: center; gap: 13px; padding: 11px 12px;
  border-radius: var(--r-sm); border-left: 3px solid var(--line);
  transition: background .13s; }
.todoitem + .todoitem { margin-top: 4px; }
.todoitem:hover { background: #f7faf9; }
.todoitem.urgent { border-left-color: var(--neg); background: #fdf7f6; }
.todoitem.urgent:hover { background: var(--neg-soft); }
.todo-ico { font-size: 17px; line-height: 1; flex: none; width: 22px; text-align: center; }
.todo-txt { flex: 1; min-width: 0; color: var(--ink); display: block; }
.todo-txt:hover { text-decoration: none; }
.todo-titel { display: block; font-weight: 600; font-size: 14.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo-txt:hover .todo-titel { color: var(--brand-ink); }
.todo-detail { display: block; color: var(--muted); font-size: 13px; margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo-betrag { flex: none; font-weight: 700; font-variant-numeric: tabular-nums;
  font-size: 15px; }

/* Loeschen/Ausblenden je Zeile – erscheint beim Ueberfahren der Zeile */
.todoitem form { flex: none; display: flex; margin: 0; }
.todo-x { background: none; border: 0; width: 26px; height: 26px; padding: 0;
  border-radius: 50%; cursor: pointer; color: var(--muted); font-size: 14px;
  line-height: 1; opacity: 0; transition: opacity .13s, background .13s, color .13s; }
.todoitem:hover .todo-x, .todo-x:focus-visible { opacity: 1; }
.todo-x:hover { background: var(--neg-soft); color: var(--neg); }
@media (hover: none) { .todo-x { opacity: 1; } }   /* Touch: immer sichtbar */

/* „Erledigt"-Haken je Punkt – IMMER sichtbar (nicht erst bei Hover) */
.todo-done { background: none; border: 1px solid var(--line); width: 28px;
  height: 28px; padding: 0; border-radius: 50%; cursor: pointer;
  color: var(--muted); font-size: 15px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: background .13s, color .13s, border-color .13s; }
.todo-done:hover, .todo-done:focus-visible {
  background: var(--pos-soft); color: var(--pos); border-color: var(--pos); }
.todo-edit-btn:hover, .todo-edit-btn:focus-visible {
  background: var(--brand-soft); color: var(--brand); border-color: var(--brand); }

/* Bearbeiten-Fenster (Modal) fuer einen manuellen Merkposten */
.todo-modal { width: min(440px, 92vw); border: 1px solid var(--line);
  border-radius: var(--r); padding: 20px 22px; box-shadow: var(--sh-3);
  color: var(--ink); background: var(--card); position: relative; }
.todo-modal::backdrop { background: rgba(16,33,29,.42); backdrop-filter: blur(1px); }
.todo-modal h3 { font-size: 17px; }
.todo-modal .modal-close { position: absolute; top: 10px; right: 12px;
  background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer;
  color: var(--muted); width: 30px; height: 30px; border-radius: 50%; }
.todo-modal .modal-close:hover { background: var(--line-2); color: var(--ink); }

/* Erfassen + ausgeblendete Punkte */
.todoneu, .todohidden { margin-top: 12px; padding-top: 10px;
  border-top: 1px solid var(--line); }
.todoneu > summary, .todohidden > summary { cursor: pointer; font-size: 13.5px;
  font-weight: 600; color: var(--muted); list-style: none; padding: 2px 0; }
.todoneu > summary:hover, .todohidden > summary:hover { color: var(--brand-ink); }
.todoneu > summary::-webkit-details-marker,
.todohidden > summary::-webkit-details-marker { display: none; }
.todoneu > summary::before, .todohidden > summary::before {
  content: "›"; display: inline-block; margin-right: 7px; transition: transform .13s; }
.todoneu[open] > summary::before, .todohidden[open] > summary::before {
  transform: rotate(90deg); }
.hiddenrow { display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.hiddenrow:last-of-type { border-bottom: 0; }

.allclear { display: flex; align-items: center; gap: 14px; padding: 18px 4px 20px; }
.allclear-ico { display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%; background: var(--pos-soft);
  color: var(--pos); font-size: 20px; font-weight: 700; flex: none; }

/* Objektkarten */
.objekt { display: block; color: var(--ink); margin-bottom: 0;
  transition: box-shadow .15s, border-color .15s, transform .15s; }
.objekt:hover { text-decoration: none; box-shadow: var(--sh-3);
  border-color: #cfe0d6; transform: translateY(-2px); }
.objekt-head { display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px; }
.objekt-name { font-size: 16px; letter-spacing: -.1px; }
.objekt-adresse { font-size: 13px; margin-top: 2px; }
.objekt-mieter { margin-top: 10px; font-size: 14px; }
.objekt-mieter .mieter { font-weight: 600; }

.paybar { height: 7px; border-radius: 20px; background: var(--line-2);
  margin-top: 14px; overflow: hidden; }
.paybar-fill { height: 100%; border-radius: 20px; background: var(--pos);
  transition: width .3s; }
.paybar-fill.warn { background: var(--warn); }
.paybar-lbl { display: flex; gap: 7px; flex-wrap: wrap; font-size: 12.5px;
  margin-top: 6px; }

.objekt-zahlen { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.objekt-zahlen > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.oz-val { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums;
  letter-spacing: -.2px; }
.oz-lbl { font-size: 11.5px; color: var(--muted); letter-spacing: .2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 520px) {
  .objekt-zahlen { grid-template-columns: repeat(2, 1fr); row-gap: 12px; }
}

/* ============ Verbindlichkeiten & Referenzobjekte ============ */
.kredit { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; }
.kredit:first-of-type { border-top: 0; }

.reffotos { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.reffoto { width: 210px; display: flex; flex-direction: column; gap: 8px; }
.reffoto img { width: 100%; height: 140px; object-fit: cover;
  border-radius: var(--r-sm); border: 1px solid var(--line); display: block; }
.reffoto.upload { justify-content: center; border: 1px dashed #c8d5cd;
  border-radius: var(--r-sm); padding: 12px; background: #fbfdfc; }
.reffoto.upload input[type=file] { font-size: 12.5px; padding: 6px; }

/* Kennzahlenraster der Referenzobjekte: 5 Spalten, bricht sauber um */
.refzahlen { grid-template-columns: repeat(5, 1fr); row-gap: 14px; }
@media (max-width: 900px) { .refzahlen { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .refzahlen { grid-template-columns: repeat(2, 1fr); } }

/* Mail-Ansicht (Alt – bleibt fuer IMAP-Fallback) */
.mail-layout { display: grid; grid-template-columns: 200px 1fr; gap: 16px; }
.maillist tr { cursor: pointer; }

/* ============ Modernes Mailmodul ============ */
.mail-wrap { display: grid; grid-template-columns: 232px 1fr; gap: 16px; align-items: start; }
@media (max-width: 820px) { .mail-wrap { grid-template-columns: 1fr; } }

/* Breite Seite (Mail-3-Spalten): volle Breite statt zentrierter 1120px-Spalte,
   mit 1 cm Abstand zur linken Menueleiste (Kopf + Spalten gemeinsam eingerueckt) */
main.wide { max-width: none; margin: 22px 0; padding: 0 22px 0 1cm; }

/* 3-Spalten-Ansicht: Ordner | Liste | Lesebereich */
.mailview { display: grid; grid-template-columns: 210px 380px 1fr; gap: 14px;
  align-items: start; }
.mailmid { min-width: 0; }
.reading { min-height: 60vh; position: sticky; top: 12px; }
.reading-empty { display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 50vh; color: var(--muted); text-align: center; gap: 10px; }
.reading-empty .re-ic { font-size: 46px; opacity: .35; }
.rsubject { margin: 0 0 12px; font-size: 20px; }
@media (max-width: 1100px) {
  .mailview { grid-template-columns: 190px 1fr; }
  .reading { grid-column: 1 / -1; position: static; }
}
@media (max-width: 720px) {
  main.wide { padding: 0 16px; }
  .mailview { grid-template-columns: 1fr; }
}

/* Kopfleiste */
.mailbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.mailbar h1 { margin: 0; font-size: 22px; }
.mailbar .who { color: var(--muted); font-size: 13px; font-weight: 500; }
.mailbar .spacer { flex: 1; }
.mailsearch { position: relative; }
.mailsearch input { width: 230px; padding: 8px 12px 8px 32px; border-radius: 20px; margin: 0; }
.mailsearch::before { content: "🔍"; position: absolute; left: 11px; top: 8px; font-size: 13px; opacity: .55; }

/* Ordnerspalte */
.folders { padding: 8px; position: sticky; top: 12px; }
.folders a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--ink); font-size: 14px; font-weight: 500; }
.folders a:hover { background: var(--brand-soft); text-decoration: none; }
.folders a.active { background: var(--brand); color: #fff; }
.folders a .fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folders a .fcount { font-size: 11.5px; font-weight: 700; background: var(--pos-soft); color: var(--brand-d);
  border-radius: 20px; padding: 1px 8px; min-width: 20px; text-align: center; }
.folders a.active .fcount { background: rgba(255,255,255,.28); color: #fff; }
.folders .sigrow { margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.folders .sigrow a { color: var(--muted); font-weight: 500; }

/* Ordner anlegen */
.neworder { display: flex; gap: 6px; margin-top: 8px; }
.neworder input { margin: 0; padding: 6px 8px; font-size: 13px; }
.neworder button { padding: 6px 11px; }

/* Bulk-Toolbar */
.bulkbar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; margin-bottom: 10px; flex-wrap: wrap; }
.bulkbar .spacer { flex: 1; }
.bulkbar .selall { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; color: var(--muted); }
.bulkbar .selall input { width: auto; margin: 0; }
.bulkbar .movesel { width: auto; margin: 0; padding: 5px 8px; font-size: 13px; }

/* Nachrichtenliste */
.mlist { padding: 0; overflow: hidden; }
.mrow { display: grid; grid-template-columns: 22px 1fr; gap: 12px; align-items: center;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  color: var(--ink); transition: background .12s; }
.mrow .msel { width: auto; margin: 0; align-self: center; }
.mrow.sel { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.mopen { display: flex; gap: 12px; align-items: flex-start; min-width: 0; color: var(--ink); cursor: pointer; }
.mopen .avatar { flex: none; }
.mdate { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; padding-left: 8px; }
.mopen:hover { text-decoration: none; }
.rowacts { display: inline-flex; gap: 8px; margin-top: 2px; }
.rowacts a { font-size: 15px; text-decoration: none; opacity: .55; }
.rowacts a:hover { opacity: 1; }
.chip .lnk { background: none; border: 0; cursor: pointer; font-size: 14px; padding: 0 0 0 4px;
  color: var(--muted); width: auto; }
.chip .lnk:hover { color: var(--brand); }
.mrow:last-child { border-bottom: 0; }
.mrow:hover { background: #f7faf9; text-decoration: none; }
.mrow.unseen { background: var(--brand-soft); }
.mrow.unseen .msubj { font-weight: 700; }
.mrow.unseen .mfrom { font-weight: 700; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; color: #fff; font-weight: 700; font-size: 15px; }
.mmid { min-width: 0; }
.mtop { display: flex; align-items: baseline; gap: 8px; }
.mfrom { font-size: 14px; color: var(--ink); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.mdot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex: none; align-self: center; }
.msubj { font-size: 13.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; margin-top: 1px; }
.mprev { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; margin-top: 2px; }
.mmeta { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
  color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.mlist .empty { padding: 40px 16px; text-align: center; color: var(--muted); }

/* Paginierung */
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 14px;
  color: var(--muted); font-size: 13px; }

/* Leseansicht */
.readhead { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 4px; }
.readhead .avatar { width: 46px; height: 46px; font-size: 17px; }
.readmeta { min-width: 0; flex: 1; }
.readmeta .rfrom { font-weight: 700; font-size: 15px; }
.readmeta .rto { color: var(--muted); font-size: 13px; margin-top: 2px; }
.readmeta .rdate { color: var(--muted); font-size: 12.5px; }
.mailactions { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.mailbody { border-top: 1px solid var(--line); padding-top: 14px; }
.mailbody pre { white-space: pre-wrap; font-family: inherit; margin: 0; font-size: 14.5px; line-height: 1.5; }
.mailbody iframe { width: 100%; border: 0; min-height: 320px; background: #fff; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 2px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--line-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 6px 10px; font-size: 13px; color: var(--ink); }
.chip:hover { background: var(--brand-soft); text-decoration: none; }
@media (max-width: 720px) { .mail-wrap { grid-template-columns: 1fr; } .mfrom { max-width: 45%; } }

/* ============================ Kontakte / Adressbuch ============================ */
.kfilter { display: flex; justify-content: space-between; gap: 14px;
  flex-wrap: wrap; align-items: center; }
.kchips { display: flex; gap: 6px; flex-wrap: wrap; }
.kchip { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line);
  font-size: 13px; color: var(--muted); background: #fff; white-space: nowrap; }
.kchip:hover { background: var(--brand-soft); color: var(--brand-ink);
  text-decoration: none; }
.kchip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.ksearch { display: flex; gap: 6px; align-items: center; }
.ksearch input[type="search"] { min-width: 220px; }

.kgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px; margin-top: 14px; }
.kcard { display: flex; gap: 13px; align-items: flex-start; padding: 14px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--sh-1); transition: box-shadow .13s, border-color .13s; }
.kcard:hover { box-shadow: var(--sh-2); border-color: var(--brand);
  text-decoration: none; }
.kavatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover;
  flex: none; }
.kavatar.ph { display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand-ink); font-weight: 700;
  font-size: 19px; }
.kbody { min-width: 0; }
.kname { font-weight: 600; font-size: 15.5px; color: var(--ink); }
.kfirma { font-size: 13px; color: var(--muted); margin-bottom: 2px; }
.kcard .badge { margin-top: 4px; }
.kmeta { display: flex; flex-direction: column; gap: 2px; margin-top: 6px;
  font-size: 13px; color: var(--muted); }
.kmeta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.kform { display: grid; grid-template-columns: 220px 1fr; gap: 16px;
  align-items: start; }
.kfoto { text-align: center; }
.kfoto-img { width: 150px; height: 150px; border-radius: 12px; object-fit: cover;
  display: block; margin: 0 auto; }
.kfoto-img.ph { display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft); color: var(--brand-ink); font-weight: 700;
  font-size: 44px; }
.kfields textarea { width: 100%; resize: vertical; }
@media (max-width: 720px) { .kform { grid-template-columns: 1fr; } }

/* ============ Rich-Text-Editor (Mail verfassen / Signatur) ============ */
.compose .row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 720px) { .compose .row { grid-template-columns: 1fr; } }
.rte { border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: #fff; }
.rte-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 6px 8px;
  background: var(--line-2); border-bottom: 1px solid var(--line); }
.rte-tools button { background: #fff; border: 1px solid var(--line); border-radius: 6px;
  min-width: 30px; height: 28px; padding: 0 8px; cursor: pointer; font-size: 13px; color: var(--ink); }
.rte-tools button:hover { background: var(--brand-soft); }
.rte-tools .sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.rte-tools .rte-color { display: inline-flex; align-items: center; gap: 4px; font-weight: 700;
  padding: 0 6px; height: 28px; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; }
.rte-tools .rte-color input { width: 22px; height: 20px; padding: 0; border: 0; margin: 0; background: none; cursor: pointer; }
.rte-tools .rte-size { height: 28px; margin: 0; padding: 0 6px; font-size: 13px; width: auto; }
/* Zeilenabstand im Editor = einfach (1,0), wie in der gesendeten Mail. */
.rte-body { min-height: 280px; padding: 14px 16px; outline: none; font-size: 14.5px; line-height: 1.0; }
.rte-body p, .rte-body div { margin: 0; }
.rte-body:focus { box-shadow: none; }
.rte-body img { max-width: 100%; }
.rte-body blockquote { margin: 0 0 0 10px; padding-left: 12px; border-left: 2px solid #ccc; color: #555; }

/* ============ Cloud: Drag & Drop ============ */
.drag-griff { cursor: grab; color: var(--muted); margin-right: 6px; user-select: none; font-size: 13px; }
#cloudtab tr[draggable="true"] { cursor: grab; }
#cloudtab tr.drag-aktiv { opacity: .45; }
#cloudtab tr.drop-hover > td { background: var(--brand-soft); box-shadow: inset 0 0 0 2px var(--brand); }

/* ============ Dokumenten-Creator (PDF-Zusatztexte) ============ */
.pdftexte { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 18px; margin: 12px 0 6px; }
.pdftexte .pdftext-item label { font-size: 13px; font-weight: 600; }
.pdftexte textarea { margin-top: 4px; }
@media (max-width: 720px) { .pdftexte { grid-template-columns: 1fr; } }

/* ============ Dokumentvorlagen-Editor (Split-View + Live-Vorschau) ============ */
.vorl-topbar { display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin: 0 0 16px; }
.vorl-topact { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vorl-topact select { width: auto; min-width: 230px; }

.vorl-split { display: grid; grid-template-columns: minmax(360px, 460px) 1fr; gap: 20px; align-items: start; }
@media (max-width: 980px) { .vorl-split { grid-template-columns: 1fr; } }

/* Linke Eingabespalte */
.vorl-edit { padding: 0; overflow: hidden; }
.vorl-tools { position: sticky; top: 0; z-index: 5; border-radius: var(--r) var(--r) 0 0;
  border-bottom: 1px solid var(--line); }
.vorl-field { padding: 12px 16px 0; }
.vorl-field:last-of-type { padding-bottom: 4px; }
.vorl-field > label { font-weight: 600; color: var(--ink); font-size: 13px; }
.vorl-edit .inline { padding: 12px 16px 16px; }
.vorl-ed { min-height: 70px; }

/* Rechte Vorschau: A4-Seite */
.vorl-preview { position: sticky; top: 12px; }
.pv-page { background: #fff; border: 1px solid var(--line); border-radius: 6px;
  box-shadow: var(--sh-3); padding: 26px 30px 22px; max-width: 720px; margin: 0 auto;
  font-size: 13px; color: #16211d; min-height: 60vh; }
.pv-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; position: relative; }
.pv-sender { line-height: 1.45; }
.pv-sender .pv-n1 { font-weight: 700; font-size: 15px; }
.pv-sender .pv-n2 { font-weight: 700; font-size: 14px; }
.pv-sender .pv-kontakt { color: #333; margin-top: 2px; }
.pv-logo { height: 34px; width: auto; }
.pv-lock { position: absolute; right: 0; top: 40px; font-size: 10.5px; color: var(--muted);
  background: var(--line-2); border-radius: 20px; padding: 1px 8px; }
.pv-line { border-top: 1px solid #b4b4b4; margin: 10px 0 14px; }
.pv-region { margin: 0 0 12px; line-height: 1.5; white-space: normal; }
.pv-region.pv-right { text-align: right; }
.pv-region.pv-leer { color: #9aa4a0; }
.pv-region.pv-fix { color: #2a2a2a; }
.pv-ph { color: #b3bbb7; font-style: italic; }
.pv-foot { margin-top: 22px; padding-top: 8px; border-top: 1px solid #ddd;
  text-align: center; color: #777; font-size: 11px; font-style: italic; }

/* Automatischer (fixer) Inhalt */
.pv-auto { position: relative; background: #f6f8f7; border: 1px dashed #c7d3cd;
  border-radius: 8px; padding: 14px 16px 12px; margin: 4px 0 14px; }
.pv-auto-tag { position: absolute; top: -9px; left: 12px; background: var(--brand-soft);
  color: var(--brand-ink); font-size: 10.5px; font-weight: 700; padding: 1px 8px;
  border-radius: 20px; letter-spacing: .2px; }
.pv-auto h3 { margin: 4px 0 8px; font-size: 14px; }
.pv-auto .pv-note { color: #667; font-size: 11.5px; margin: 8px 0 0; }
.pv-block { font-weight: 600; }
.pv-tab { width: 100%; border-collapse: collapse; font-size: 12px; }
.pv-tab td { border: 1px solid #d7ded9; padding: 4px 8px; }
.pv-tab .r { text-align: right; font-variant-numeric: tabular-nums; }
.pv-tab .th td { background: #eef2f0; font-weight: 700; }
.pv-tab .sum td { background: #eaf3ee; font-weight: 700; }
