:root {
  --accent: #2f5f8f;
  --accent-dark: #22405f;
  --bg: #f2f4f6;
  --surface: #fff;
  --text: #1b2430;
  --text-2: #66717d;
  --text-3: #8a949e;
  --text-4: #aeb6bd;
  --border: #e2e6ea;
  --border-2: #eef1f3;
  --green: #1e6b3c;
  --green-bg: #e9f5ee;
  --green-border: #bfe0cc;
  --success: #2e9e5b;
  --red: #b3261e;
  --red-bg: #fdeeee;
  --warn: #f0b429;
  --warn-bg: #fdf6e7;
  --warn-border: #e4c878;
  --warn-text: #7a5c14;
  --drop: #eaf2fa;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-family: 'IBM Plex Sans', Helvetica, Arial, sans-serif; color: var(--text); }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
button { font-family: inherit; }

@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Header ---------- */
.header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.header-inner { max-width: 1360px; margin: 0 auto; padding: 14px 28px; display: flex; align-items: center; gap: 20px; }
.logo-row { display: flex; align-items: center; gap: 12px; }
.logo { width: 34px; height: 34px; border-radius: 8px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; }
.app-title { font-size: 16px; font-weight: 600; line-height: 1.2; }
.app-subtitle { font-size: 12px; color: var(--text-2); }
.month-nav { display: flex; align-items: center; gap: 8px; margin-left: 16px; }
.month-btn { width: 28px; height: 28px; border: 1px solid #d7dde2; background: #fff; border-radius: 6px; cursor: pointer; color: #4a5560; font-size: 14px; }
.month-btn:hover { background: var(--bg); }
.month-label { font-size: 14px; font-weight: 600; min-width: 110px; text-align: center; }
.spacer { flex: 1; }
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-label { font-size: 13px; color: var(--text-2); }
.progress-track { width: 140px; height: 8px; background: #e7ebee; border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); transition: width 0.3s; }
.progress-fill.full { background: var(--success); }
.btn-primary { background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 10px 18px; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { border: 1px solid #d7dde2; background: #fff; color: #3d4750; border-radius: 8px; padding: 10px 16px; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn-secondary:hover { background: var(--bg); }

/* ---------- Filterzeile ---------- */
.filter-row { max-width: 1360px; margin: 0 auto; width: 100%; padding: 20px 28px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tabs { display: flex; background: #e7ebee; border-radius: 9px; padding: 3px; gap: 2px; }
.tab { border: none; border-radius: 7px; padding: 7px 14px; font-size: 13.5px; font-weight: 600; cursor: pointer; background: transparent; color: var(--text-2); display: flex; align-items: center; gap: 7px; }
.tab.active { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(20,30,40,0.1); }
.tab-badge { border-radius: 10px; padding: 1px 7px; font-size: 11px; font-weight: 700; background: var(--green-bg); color: var(--green); }
.tab-badge.open { background: var(--red-bg); color: var(--red); }
.credits-toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #3d4750; cursor: pointer; margin-left: 8px; }
.credits-toggle input { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }
.btn-small { border: 1px solid #d7dde2; background: #fff; color: var(--text-2); border-radius: 6px; padding: 5px 10px; font-size: 12px; cursor: pointer; }
.btn-small:hover { background: var(--bg); color: #3d4750; }
.import-label { font-size: 12px; color: var(--text-3); font-family: monospace; }

/* ---------- Hauptbereich ---------- */
.main { max-width: 1360px; margin: 0 auto; width: 100%; padding: 0 28px 40px; display: grid; grid-template-columns: 1fr 350px; gap: 22px; align-items: start; }
.tx-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.tx-head, .tx-row { display: grid; grid-template-columns: 74px 1fr 130px 300px; gap: 14px; align-items: center; padding: 12px 18px; }
.tx-head { padding: 10px 18px; border-bottom: 1px solid #e9edf0; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); }
.tx-row { border-bottom: 1px solid var(--border-2); background: #fff; transition: background 0.12s; }
.tx-row.done { background: #fbfcfd; }
.tx-row.credit { opacity: 0.72; }
.tx-row.dragover { background: var(--drop); outline: 2px dashed var(--accent); outline-offset: -3px; }
.tx-date { font-size: 13px; color: var(--text-2); white-space: nowrap; }
/* Buchungstext vollständig anzeigen — lange Namen/Verwendungszwecke brechen um */
.tx-name { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.tx-purpose { font-size: 12.5px; color: var(--text-3); overflow-wrap: anywhere; }
.tx-amount { text-align: right; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tx-amount.credit { color: var(--green); opacity: 0.85; }
.fx-hint { text-align: right; font-size: 11px; color: var(--text-4); font-variant-numeric: tabular-nums; }
.tx-slot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.hint-drag { font-size: 12px; color: var(--text-4); font-style: italic; }
.hint-hidden { border: none; background: none; color: var(--text-4); font-size: 11px; cursor: pointer; padding: 0; text-decoration: underline dotted; }
.hint-hidden:hover { color: var(--accent); }
.chip-suggestion .chip-x { color: var(--warn-text); opacity: 0.7; }
.chip-suggestion .chip-x:hover { color: var(--red); opacity: 1; }
.btn-noinv { border: 1px solid #dde2e6; background: #fff; color: var(--text-2); border-radius: 6px; padding: 4px 8px; font-size: 11.5px; cursor: pointer; }
.btn-noinv:hover { background: var(--bg); color: #3d4750; }
.chip-assigned { display: flex; align-items: center; gap: 6px; background: var(--green-bg); border: 1px solid var(--green-border); color: var(--green); border-radius: 7px; padding: 5px 8px; font-size: 12px; font-weight: 500; max-width: 250px; }
.chip-assigned .fname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: monospace; font-size: 11px; }
.chip-assigned a.fname { color: inherit; text-decoration: none; cursor: pointer; }
.chip-assigned a.fname:hover { text-decoration: underline; }
.chip-x { border: none; background: none; color: inherit; cursor: pointer; padding: 0 2px; font-size: 13px; line-height: 1; }
.chip-x:hover { color: var(--red); }
.chip-noinv { display: flex; align-items: center; gap: 6px; background: #f0f2f4; border: 1px solid #dde2e6; color: #5b6670; border-radius: 7px; padding: 5px 8px; font-size: 12px; }
.inv-ki { font-size: 11.5px; color: var(--warn-text); margin-top: 3px; line-height: 1.35; }
.inv-ki.pending { color: var(--text-3); }
.badge-ki { background: #ece4f7; color: #5b3a8c; border-radius: 4px; padding: 0 4px; font-size: 10px; font-weight: 700; }
.inv-ki-ok { border: 1px solid var(--border); background: #fff; border-radius: 4px; font-size: 10.5px; padding: 0 5px; cursor: pointer; margin-left: 3px; }
.badge-rule { background: #dfe7f0; color: var(--accent); border-radius: 4px; padding: 1px 5px; font-size: 10.5px; font-weight: 600; }
.chip-suggestion { display: flex; align-items: center; gap: 7px; background: var(--warn-bg); border: 1px dashed var(--warn-border); border-radius: 7px; padding: 4px 8px; font-size: 12px; color: var(--warn-text); }
.chip-remaining { background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-text); border-radius: 7px; padding: 4px 8px; font-size: 11.5px; font-variant-numeric: tabular-nums; }
/* Differenz durch Gegenbuchung erklärt: reiner Hinweis, keine Warnfarbe */
.chip-offset { background: #f0f2f4; border: 1px solid #dde2e6; color: #5b6670; border-radius: 7px; padding: 4px 8px; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.chip-suggestion .sugg-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
/* Vorschlag & Pool-Karte: Klick öffnet die Rechnung zum Prüfen */
.chip-suggestion a.sugg-name { color: inherit; text-decoration: underline dotted; cursor: pointer; }
.chip-suggestion a.sugg-name:hover { text-decoration: underline; }
.inv-vendor a { color: inherit; text-decoration: none; }
.inv-vendor a:hover { color: var(--accent); text-decoration: underline; }
.btn-accept { background: var(--warn); border: none; color: #3d2e05; border-radius: 5px; padding: 3px 9px; font-size: 11.5px; font-weight: 700; cursor: pointer; }
.btn-accept:hover { filter: brightness(1.06); }
.badge-credit { font-size: 11.5px; color: var(--text-3); background: #f0f2f4; border-radius: 5px; padding: 3px 8px; }
.tx-empty { padding: 36px 20px; text-align: center; color: var(--text-3); font-size: 13.5px; }

/* ---------- Rechnungs-Pool ---------- */
.pool-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; position: sticky; top: 78px; display: flex; flex-direction: column; max-height: calc(100vh - 110px); }
.pool-head { padding: 14px 16px; border-bottom: 1px solid #e9edf0; display: flex; align-items: center; justify-content: space-between; }
.pool-title { font-size: 14px; font-weight: 600; }
.pool-count { font-size: 12px; color: var(--text-3); }
.dropzone { margin: 12px 16px 4px; border: 1.5px dashed #c9d1d8; border-radius: 9px; padding: 14px; text-align: center; font-size: 12.5px; color: var(--text-3); background: #fafbfc; cursor: pointer; }
.dropzone.dragover { border-color: var(--accent); background: var(--drop); color: var(--accent); }
.dropzone .browse { color: var(--accent); font-weight: 600; cursor: pointer; }
.pool-list { overflow-y: auto; padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.inv-card { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; background: #fff; cursor: grab; box-shadow: 0 1px 2px rgba(20,30,40,0.04); }
.inv-card.dragging { border-color: var(--accent); background: var(--drop); box-shadow: 0 4px 12px rgba(47,95,143,0.2); opacity: 0.6; }
.inv-icon { width: 34px; height: 38px; border-radius: 5px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; }
.inv-icon.pdf { background: var(--red-bg); color: var(--red); border: 1px solid #f2d5d3; }
.inv-icon.jpg { background: #eef4fb; color: var(--accent); border: 1px solid #d5e3f2; }
.inv-body { flex: 1; min-width: 0; user-select: text; cursor: text; }
.inv-icon { cursor: grab; }
.inv-amount { cursor: grab; }
/* Lieferantenname darf zweizeilig umbrechen — abgeschnittene Namen sind nicht lesbar */
.inv-vendor { font-size: 13px; font-weight: 600; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.inv-meta { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-amount { font-size: 13px; font-weight: 600; white-space: nowrap; }
.inv-delete { border: none; background: none; color: var(--text-4); cursor: pointer; font-size: 15px; line-height: 1; padding: 2px 4px; flex-shrink: 0; }
.inv-delete:hover { color: var(--red); }
.inv-edit { border: none; background: none; color: var(--text-4); cursor: pointer; font-size: 12px; line-height: 1; padding: 2px 4px; flex-shrink: 0; }
.inv-edit:hover { color: var(--accent); }
.inv-pay { border: 1px solid var(--border); border-radius: 6px; padding: 4px 7px; color: var(--accent); font-weight: 600; }
.inv-pay:hover { background: var(--drop); }
.pool-empty { text-align: center; padding: 24px 10px; color: var(--text-3); font-size: 13px; }
.pool-external { margin: 6px 14px 10px; font-size: 12px; color: var(--text-3); }
.pool-external a { color: var(--accent); cursor: pointer; text-decoration: underline dotted; }
.pool-external .ext-row { display: flex; gap: 8px; align-items: center; padding: 3px 0; border-top: 1px solid var(--border-2); }
.pool-external .ext-row span:first-child { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pool-empty .sub { font-size: 12px; }

/* ---------- Leerzustand ohne Import ---------- */
.empty-state { grid-column: 1 / -1; background: var(--surface); border: 1.5px dashed #c9d1d8; border-radius: 12px; padding: 60px 30px; text-align: center; color: var(--text-3); }
.empty-state.dragover { border-color: var(--accent); background: var(--drop); }
.empty-state h2 { font-size: 17px; font-weight: 600; color: var(--text); margin: 0 0 8px; }
.empty-state p { font-size: 13.5px; margin: 0 0 16px; }

/* ---------- Modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(20,28,36,0.45); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 24px; }
.overlay[hidden] { display: none; }
.modal { background: #fff; border-radius: 14px; width: 640px; max-width: 100%; max-height: 85vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(10,20,30,0.25); }
.modal-head { padding: 20px 24px 14px; border-bottom: 1px solid #e9edf0; display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 17px; font-weight: 700; }
.modal-summary { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.modal-close { border: none; background: none; font-size: 20px; color: var(--text-3); cursor: pointer; }
.modal-close:hover { color: var(--text); }
.modal-body { overflow-y: auto; padding: 14px 24px; }
.modal-section-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); margin-bottom: 8px; }
.export-list { display: flex; flex-direction: column; gap: 6px; }
.export-row { display: flex; align-items: center; gap: 10px; background: #fafbfc; border: 1px solid var(--border-2); border-radius: 8px; padding: 8px 12px; }
.export-fname { font-family: monospace; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.export-amount { margin-left: auto; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.warn-box { margin-top: 16px; background: #fdf1f0; border: 1px solid #f0c9c5; border-radius: 9px; padding: 12px 14px; font-size: 13px; color: #8c2f28; }
.modal-foot { padding: 16px 24px; border-top: 1px solid #e9edf0; display: flex; gap: 10px; justify-content: flex-end; align-items: center; }
.zip-note { margin-right: auto; font-size: 11.5px; color: var(--text-3); max-width: 210px; }
.rule-row { display: flex; align-items: center; gap: 10px; background: #fafbfc; border: 1px solid var(--border-2); border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.recon-ok { color: var(--green); font-size: 12px; white-space: nowrap; }
.recon-warn { color: var(--red); font-size: 12px; white-space: nowrap; }
.recon-muted { color: var(--text-4); font-size: 12px; }
.rule-row .chip-x { margin-left: auto; color: var(--text-3); }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #1b2430; color: #fff; border-radius: 9px; padding: 11px 18px; font-size: 13.5px; z-index: 60; animation: toastIn 0.25s ease; box-shadow: 0 8px 24px rgba(0,0,0,0.25); max-width: 80vw; }

/* ---- Mandanten & Mieter ---- */
.company-tabs { margin-left: 18px; }
.company-tabs .tab { padding: 6px 12px; font-size: 13px; }
.rents-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 26px 0; }
.rents-title { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.rent-chip { font-size: 12px; font-weight: 500; border-radius: 7px; padding: 4px 9px; border: 1px solid; }
.rent-chip.paid { background: var(--green-bg); border-color: var(--green-border); color: var(--green); }
.rent-chip.missing { background: var(--red-bg); border-color: #e8c4c1; color: var(--red); }
.rent-chip.deviation { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }
.badge-deviation { background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-text); border-radius: 4px; padding: 1px 5px; font-size: 10.5px; font-weight: 600; }
.rent-month { border: 1px solid var(--green-border); border-radius: 5px; padding: 2px 4px; font-size: 11px; color: var(--green); background: #fff; max-width: 170px; }
.tenant-select { border: 1px solid #d7dde2; border-radius: 6px; padding: 4px 6px; font-size: 12px; color: var(--text-2); background: #fff; max-width: 150px; }
.tenant-block { background: #fafbfc; border: 1px solid var(--border-2); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.tenant-block.inactive { opacity: 0.55; }
.tenant-head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin-bottom: 6px; }
.tenant-head .btn-small { margin-left: auto; }
.tenant-meta { color: var(--text-3); font-size: 12px; }
.tenant-row { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); margin-top: 6px; flex-wrap: wrap; }
.t-input { border: 1px solid #d7dde2; border-radius: 6px; padding: 4px 7px; font-size: 12.5px; flex: 1; min-width: 60px; }
.tenant-rents { margin-top: 6px; }
.rent-hist-row { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); padding: 3px 0; }
.rent-table { border-collapse: collapse; font-size: 12.5px; width: 100%; }
.rent-table th, .rent-table td { padding: 4px 6px; text-align: center; border-bottom: 1px solid var(--border-2); }
.rent-table th { color: var(--text-3); font-size: 11px; font-weight: 600; }
.rent-table td.ok { color: var(--green); font-weight: 700; }
.rent-table td.bad { color: var(--red); font-weight: 700; }
.rent-table td.warn { color: var(--warn-text); font-weight: 700; }
.rent-table td.muted { color: #c6ccd2; }
.rent-legend { margin-top: 6px; font-size: 11.5px; color: var(--text-3); }

/* ---- E-Mail-Import ---- */
.rule-add { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.badge-month { background: var(--warn-bg); border: 1px solid var(--warn-border); color: var(--warn-text); }
.badge-btn { border: none; cursor: pointer; }
.badge-btn:hover { background: var(--accent); color: #fff; }
.noinv-note { color: var(--text-3); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; }
.inv-card.credit-note .inv-amount { color: #1e6b3c; }
.chip-suggestion .sugg-name a { color: inherit; }
.rule-add .t-input { flex: 1; }

/* ---- Pool-Aktionszeile + begrenzte Hinweisliste ---- */
.pool-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px 0; }
.pool-actions .credits-toggle { font-size: 12px; margin-left: auto; gap: 5px; color: var(--text-3); }
.pool-actions .credits-toggle input { width: 13px; height: 13px; }

/* Große Monitore (2560×1440): Breite ausnutzen — breiter Beleg-Pool, breite
   Beleg-Spalte, längere Chips, Namen im Pool umbrechen statt abschneiden */
@media (min-width: 1900px) {
  .header-inner, .filter-row, .main { max-width: 2300px; }
  .main { grid-template-columns: 1fr 640px; gap: 28px; }
  .tx-head, .tx-row { grid-template-columns: 90px 1fr 150px 600px; }
  .tx-name { font-size: 15px; }
  .tx-purpose { font-size: 13px; }
  .chip-assigned { max-width: 580px; font-size: 13px; }
  .chip-assigned .fname { font-size: 12px; }
  .chip-suggestion { font-size: 13px; }
  .chip-suggestion .sugg-name { max-width: 460px; }
  .noinv-note { max-width: 520px; }
  .rent-month { max-width: 260px; }
  .tenant-select { max-width: 240px; }
  .inv-vendor { font-size: 14px; -webkit-line-clamp: 3; }
  .inv-meta { font-size: 12.5px; white-space: normal; }
  .inv-amount { font-size: 14px; }
  .pool-card { max-height: calc(100vh - 100px); }
  .modal { width: 820px; }
}

/* ---------- Bezahlen per QR-Code ---------- */
.pay-list { display: flex; flex-direction: column; gap: 12px; }
.pay-card { display: flex; gap: 18px; align-items: center; background: #fafbfc; border: 1px solid var(--border-2); border-radius: 10px; padding: 14px 16px; }
.pay-card.done { opacity: 0.45; }
.pay-qr { width: 230px; height: 230px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: #fff; border-radius: 6px; }
.pay-qr svg { width: 100%; height: 100%; display: block; shape-rendering: crispEdges; }
.pay-card.no-qr .pay-qr { height: auto; min-height: 60px; background: none; border: 1px dashed var(--border); color: var(--text-4); font-size: 12px; }
.pay-info { flex: 1; min-width: 0; font-size: 13px; }
.pay-name { font-weight: 700; font-size: 15px; }
.pay-amount { font-size: 20px; font-weight: 700; margin: 2px 0 6px; }
.pay-iban { font-family: ui-monospace, Menlo, Consolas, monospace; margin-bottom: 4px; }
.pay-detail { color: var(--text-3); }
.pay-note { margin-top: 6px; color: var(--red); }
.pay-check { display: inline-flex; gap: 6px; align-items: center; margin-top: 8px; cursor: pointer; }
.sugg-total { font-weight: 400; opacity: 0.7; }

/* ---------- Anmeldung (BZ_AUTH=1) ---------- */
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; width: 420px; max-width: 100%; padding: 28px; box-shadow: 0 12px 40px rgba(10,20,30,0.08); display: flex; flex-direction: column; gap: 18px; }
.login-card section { display: flex; flex-direction: column; gap: 12px; }
.login-card section[hidden] { display: none; }
.login-wide { width: 100%; }
.login-hint { font-size: 12.5px; color: var(--text-2); margin: 0; line-height: 1.45; }
.login-text { font-size: 14px; margin: 0; line-height: 1.5; }
.login-h { font-size: 17px; margin: 0; }
.login-msg { background: var(--red-bg); color: var(--red); border-radius: 8px; padding: 10px 12px; font-size: 13.5px; }
.login-msg.ok { background: var(--green-bg); color: var(--green); }
.login-first { border-top: 1px solid var(--border-2); padding-top: 14px; }
.login-first summary { cursor: pointer; font-size: 13.5px; color: var(--accent); }
.login-first form { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--text-2); }
.login-card input { font: inherit; font-size: 14px; padding: 9px 10px; border: 1px solid #d7dde2; border-radius: 7px; color: var(--text); }
.login-card input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
button.busy { opacity: 0.6; cursor: wait; }
.user-box { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.user-box[hidden] { display: none; }

/* Datasafe-Abgleich im Export-Modal */
.ds-folder { display: flex; justify-content: space-between; align-items: baseline; margin: 10px 0 4px; }
.ds-folder a { font-size: 12px; }
.ds-ok { color: var(--green); }
.ds-open { color: var(--red); }
.ds-details { margin: 0 0 6px 12px; font-size: 12px; }
.ds-details summary { cursor: pointer; }
.ds-file { padding-left: 14px; word-break: break-all; }

/* Behördenpost */
.agency-warn { background: #fdf3e0; border: 1px solid #eed9a8; color: #6b4e12; border-radius: 6px; padding: 8px 10px; font-size: 13px; margin-bottom: 10px; }
.agency-msg { border: 1px solid #e3e7ea; border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.agency-msg.unread { border-left: 3px solid var(--accent); }
.agency-msg.unread .agency-subject { font-weight: 600; }
.agency-meta { font-size: 12px; color: var(--text-2); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.agency-subject { font-size: 14px; margin: 3px 0; overflow-wrap: anywhere; }
.agency-body { font-size: 12px; color: var(--text-2); white-space: pre-wrap; margin: 4px 0; overflow-wrap: anywhere; }
.agency-badge { background: #b3372f; color: #fff; border-radius: 4px; padding: 1px 6px; font-size: 11px; font-weight: 600; }
.agency-files { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: 13px; margin-top: 6px; }
.agency-file { display: inline-flex; gap: 6px; align-items: center; overflow-wrap: anywhere; }
.agency-empty { color: var(--text-2); font-size: 13px; padding: 12px 0; }
.agency-section { max-width: 1360px; margin: 0 auto; width: 100%; padding: 0 28px 40px; }
.agency-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
body.agency-view .main, body.agency-view #rentsBar, body.agency-view .month-nav, body.agency-view .progress-row,
body.agency-view .filter-row > :not(.tabs) { display: none !important; }
@media (max-width: 640px) { .agency-section { padding: 0 16px 32px; } }


/* Offene Zahlungen (UVA, Auszahlungsjournal) — roter Hinweis ganz oben */
.pay-banner { padding: 10px 26px 0; display: flex; flex-direction: column; gap: 8px; }
.pay-order { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--red-bg); border: 1.5px solid var(--red); color: var(--red); border-radius: 9px; padding: 10px 14px; font-size: 13.5px; }
.pay-order-main { flex: 1; min-width: 260px; }
.pay-order-main strong { font-weight: 700; }
.pay-order-sub { font-size: 12px; opacity: 0.85; margin-top: 2px; }
.pay-order label { display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px; }
.pay-order input[type=date] { font: inherit; padding: 3px 6px; border: 1px solid #e8c4c1; border-radius: 6px; }
.pay-order .pay-xml { background: var(--red); color: #fff; border-radius: 7px; padding: 6px 12px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.pay-order .pay-xml:hover { filter: brightness(1.1); }

/* Kontoauszüge (camt.053): Kontostand + Lücken-Warnung neben dem Import */
.stmt-status { font-size: 12px; color: var(--text-3); display: flex; gap: 10px; flex-wrap: wrap; }
.stmt-status .stmt-warn { color: var(--red); font-weight: 600; }

/* Interne Liste Michael/Roland */
.int-btn { border: 1px solid var(--border-2); background: #fff; border-radius: 9px; padding: 7px 12px; font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }
.int-btn.has-open { border-color: #c9b6e4; background: #f6f1fc; color: #4b2c7a; font-weight: 600; }
.int-sums { display: flex; gap: 18px; margin-top: 6px; font-size: 14px; }
.int-sums strong { font-size: 16px; }
.int-filter { display: flex; gap: 6px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.int-filter .active { background: #4b2c7a; color: #fff; border-color: #4b2c7a; }
.int-sep { color: var(--text-4); }
.int-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.int-table td, .int-table th { padding: 7px 6px; border-bottom: 1px solid #eef1f3; text-align: left; vertical-align: top; }
.int-table th { font-size: 11px; text-transform: uppercase; color: var(--text-3); letter-spacing: .03em; }
.int-table td.num { text-align: right; white-space: nowrap; }
.int-table tr.done td { color: var(--text-4); }
.int-table tr.done td.desc { text-decoration: line-through; }
.int-table a { color: inherit; }
.int-hint { font-size: 12px; color: var(--text-3); margin-top: 12px; }
.int-mark { border: none; background: none; cursor: pointer; font-size: 13px; opacity: .45; padding: 0 4px; }
.int-mark:hover { opacity: 1; }
.int-chip { display: inline-flex; align-items: center; gap: 4px; background: #f6f1fc; color: #4b2c7a; border: 1px solid #e2d6f3; border-radius: 6px; padding: 1px 6px; font-size: 11.5px; margin: 3px 4px 0 0; }
.int-chip.done { opacity: .55; text-decoration: line-through; }
.int-chip button { border: none; background: none; color: inherit; cursor: pointer; padding: 0 2px; }
.int-form { display: flex; flex-direction: column; gap: 12px; }
.int-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.int-form input[type=text] { font: inherit; padding: 7px 9px; border: 1px solid var(--border-2); border-radius: 7px; }
.int-persons { display: flex; gap: 16px; }
.int-persons label { flex-direction: row; align-items: center; gap: 6px; }
.int-actions { display: flex; justify-content: flex-end; }
.int-table .sub, #internalOverlay .modal-title .sub { font-size: 11.5px; color: var(--text-3); font-weight: 400; }
.tx-row.flash { background: #f6f1fc; transition: background .4s; }

/* Hover-Vorschau der Belege (erste Seite) */
.inv-preview { position: fixed; z-index: 80; width: min(680px, 52vw); max-width: calc(100vw - 28px); background: #fff; border: 1px solid var(--border-2); border-radius: 8px; box-shadow: 0 16px 48px rgba(10,20,30,0.28); padding: 6px; pointer-events: none; }
.inv-preview[hidden] { display: none; }
.inv-preview img { display: block; width: 100%; max-height: calc(100vh - 60px); object-fit: contain; object-position: top; border-radius: 4px; }
.inv-preview-pages { font-size: 11.5px; color: var(--text-3); text-align: center; padding-top: 4px; }
.inv-icon[data-preview-inv] { cursor: zoom-in; }

/* Kontostände (Knopf oben) */
.int-btn.active { background: #e8f3ec; border-color: #9fcdb0; color: #1d5a33; font-weight: 600; }
.balances-bar { padding: 10px 26px 0; display: flex; gap: 10px; flex-wrap: wrap; }
.balance-card { background: var(--surface, #fff); border: 1px solid var(--border-2); border-radius: 10px; padding: 9px 14px; min-width: 220px; cursor: pointer; }
.balance-card:hover { border-color: #9fcdb0; }
.balance-card .bc-label { font-size: 12px; color: var(--text-3); }
.balance-card .bc-amount { font-size: 19px; font-weight: 700; margin: 1px 0; }
.balance-card .bc-amount.neg { color: var(--red); }
.balance-card .bc-sub { font-size: 11.5px; color: var(--text-3); }
.balance-card .bc-sub.old { color: #a06a00; }
.balance-card .bc-warn { font-size: 11.5px; color: var(--red); margin-top: 3px; }
/* Kopfzeile: bei schmalen Fenstern umbrechen statt rechts abschneiden */
.header-inner { flex-wrap: wrap; row-gap: 10px; }
@media (max-width: 1500px) { .header-inner { gap: 12px; } .int-btn { padding: 6px 10px; font-size: 12.5px; } }
.balance-card .bc-amount.prov { color: #6b5a1f; }

/* KI-Zuordnungsvorschlag */
.chip-suggestion.chip-ai { background: #f6f1fc; border-color: #c9b6e4; color: #4b2c7a; flex-wrap: wrap; }
.chip-ai .ai-tag { background: #4b2c7a; color: #fff; border-radius: 4px; padding: 0 5px; font-size: 10.5px; font-weight: 700; margin-right: 3px; }
.chip-ai .ai-why { display: block; font-size: 11.5px; opacity: .85; margin-top: 2px; }
.chip-ai a { color: inherit; }

/* Hinweis für die Buchhaltung */
.bh-chip { display: inline-block; background: #fdf6e3; border: 1px solid #eed9a8; color: #6b4e12; border-radius: 6px; padding: 2px 7px; font-size: 11.5px; margin-top: 3px; }

/* Rechnungsadresse falsch */
.inv-addr { font-size: 11.5px; color: #8a4b00; background: #fff4e5; border: 1px solid #f1d3a8; border-radius: 6px; padding: 3px 6px; margin-top: 4px; }
.int-btn.addr-btn { border-color: #f1d3a8; background: #fff4e5; color: #8a4b00; font-weight: 600; }

/* Nachfragen */
.int-btn.fu-btn { border-color: #b9d3ee; background: #eef5fc; color: #1f4e79; font-weight: 600; }
.fu-chip { display: inline-block; background: #eef5fc; border: 1px solid #b9d3ee; color: #1f4e79; border-radius: 6px; padding: 2px 7px; font-size: 11.5px; margin: 3px 4px 0 0; }
.fu-chip.done { opacity: .55; text-decoration: line-through; }
.int-table .ok { color: #1e6b3c; font-size: 12px; }
.int-table td.num { text-align: right; white-space: nowrap; }
.int-table tr.addr-old td { color: var(--text-4, #8a949c); }
.int-table td.addr-old-head { background: #f5f7f9; color: var(--text-3); font-size: 12px; font-weight: 600; }
.addr-mail { background: #f7f9fb; border: 1px solid var(--border-2); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.addr-mail textarea { width: 100%; font: 12.5px/1.45 ui-monospace, Menlo, Consolas, monospace; border: 1px solid var(--border-2); border-radius: 6px; padding: 8px; box-sizing: border-box; }
.addr-mail-actions { display: flex; gap: 8px; }
.addr-mail-actions a.btn-small { text-decoration: none; display: inline-flex; align-items: center; }
