/* ═══════════════════════════════════════════════════════════════
   STONECRM, Stylesheet "Basalt"
   Dunkle, schmale Kopfzeile in Anthrazit, darunter alles weiß und ruhig. Statusfarbe als Leiste
   links an jeder Karte. Alle Farben als Tokens, alle Textfarben mit Kontrast über 4,5:1, nichts
   unter 12 px, Icons nur als Inline-SVG. Die Akzentfarbe (--primary) stellt der Betrieb selbst ein,
   app.js setzt dazu --primary-text und --primary-ink, die übrigen Töne leiten sich hier ab.
═══════════════════════════════════════════════════════════════ */
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 500; font-display: swap; src: url('04-Fonts/manrope-500.woff2') format('woff2'); }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 600; font-display: swap; src: url('04-Fonts/manrope-600.woff2') format('woff2'); }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 700; font-display: swap; src: url('04-Fonts/manrope-700.woff2') format('woff2'); }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 800; font-display: swap; src: url('04-Fonts/manrope-800.woff2') format('woff2'); }

:root {
  color-scheme: light;
  /* Marke */
  --primary:        #e8c655;   /* Akzent (Kalkgelb, vom Betrieb änderbar): nur als Fläche oder Linie */
  --primary-ink:    #7a5c00;   /* Akzent als Textfarbe, auf Weiß über 4,5:1 */
  --primary-dark:   color-mix(in srgb, var(--primary) 72%, #000);   /* Ränder, Hover, Fokus */
  --primary-light:  color-mix(in srgb, var(--primary) 18%, #fff);
  --primary-text:   #18242a;   /* Schrift auf dem Akzent */
  /* Basalt */
  --slate:          #1f2326;
  --slate-2:        #15181a;
  --slate-soft:     #dfe6ea;
  /* Flächen und Linien */
  --bg:             #f6f7f8;
  --bg-2:           #eef1f3;
  --white:          #ffffff;
  --border:         #e4e8eb;
  --border-2:       #cbd3d8;
  /* Text */
  --text:           #18242a;
  --text-1:         #18242a;
  --text-2:         #4b5a63;   /* 7,3:1 */
  --text-3:         #5b6a74;   /* 5,6:1 auf Weiß, 4,9:1 auf --bg-2, für Nebeninformationen */
  --gray:           #5b6a74;
  /* Signale (alle als Text auf Weiß über 4,5:1) */
  --red:            #b91c1c;
  --lexware:        #ff4554;   /* Lexware-Logo, Markenrot, nur als Fläche im Icon */
  --red-light:      #fef2f2;
  --success:        #15803d;
  --success-light:  #dcfce7;   /* Zustände zugesagt, Termin steht (Text dazu --success) */
  --yellow:         #b45309;
  --yellow-light:   #fffbeb;
  --blue:           #1d4ed8;
  --blue-light:     #eff6ff;
  --amber:          #f59e0b;   /* Fläche und Rand für gelbe Stände (Text dazu immer --yellow) */
  --slate-light:    #94a3b8;
  --primary-hover:  color-mix(in srgb, var(--primary) 84%, #fff);
  --red-dark:       #991b1b;
  --badge:          #ff8a4c;   /* Zähler auf der dunklen Kopfzeile */
  /* Maße */
  --radius:         8px;
  --radius-md:      12px;
  --radius-pill:    999px;
  --shadow:         0 1px 2px rgba(24,36,42,.06), 0 4px 14px rgba(24,36,42,.06);
  --shadow-md:      0 2px 4px rgba(24,36,42,.08), 0 10px 24px rgba(24,36,42,.10);
  --shadow-lg:      0 12px 40px rgba(24,36,42,.18);
  --header-h:       56px;
  --toolbar-h:      50px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; font-size: 14px; font-weight: 500; line-height: 1.45; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
button { font-family: inherit; font-weight: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; font-weight: 500; color: var(--text); }
a { color: inherit; }
svg { flex-shrink: 0; }
::placeholder { color: var(--text-3); opacity: 1; }
.hidden { display: none !important; }

/* ── Knöpfe ──────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--radius-pill);
  background: var(--primary); color: var(--primary-text);
  font-size: 13px; font-weight: 700;
  transition: background .12s, transform .12s;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .45; cursor: default; }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--radius-pill);
  border: 1px solid var(--border); background: var(--white);
  color: var(--text-2); font-size: 13px; font-weight: 600;
  transition: border-color .12s, color .12s, background .12s;
}
.btn-ghost:hover { border-color: var(--border-2); color: var(--text); background: var(--bg); }
.btn-ghost:disabled { opacity: .45; cursor: default; }
.btn-gefahr { display: inline-flex; align-items: center; padding: 9px 16px; border-radius: var(--radius-pill); background: var(--red); color: #fff; font-size: 13px; font-weight: 700; }
.btn-gefahr:hover { background: var(--red-dark); }
.btn-icon, .btn-delete, .btn-mail, .btn-lexware, .btn-cal-load {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 36px; height: 36px; padding: 0 10px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--white); color: var(--text-2);
  font-size: 12px; font-weight: 600; white-space: nowrap;
  transition: border-color .12s, color .12s, background .12s;
}
.btn-icon:hover, .btn-mail:hover, .btn-lexware:hover, .btn-cal-load:hover { border-color: var(--primary-dark); color: var(--primary-ink); background: var(--primary-light); }
.btn-delete:hover { border-color: var(--red); color: var(--red); background: var(--red-light); }
.btn-cal-load:disabled { opacity: .5; cursor: wait; }
.btn-icon svg, .btn-delete svg, .btn-mail svg, .btn-lexware svg, .btn-cal-load svg { width: 16px; height: 16px; }

/* ── Kopfzeile (Basalt) ─────────────────────────────────────── */
.app-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 16px;
  background: var(--slate); color: #fff;
}
.header-left { display: flex; align-items: center; flex-shrink: 0; min-width: 0; }
.header-logo { height: 34px; width: auto; max-width: 180px; display: block; background: var(--white); border-radius: var(--radius); padding: 3px 6px; object-fit: contain; }
.header-name { font-size: 15px; font-weight: 800; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.header-search-wrap { flex: 1; min-width: 0; max-width: 420px; position: relative; display: flex; align-items: center; }
.search-icon { position: absolute; left: 12px; color: rgba(255,255,255,.7); pointer-events: none; }
.header-search {
  width: 100%; height: 36px; padding: 0 36px 0 36px;
  border: 1px solid transparent; border-radius: var(--radius);
  background: rgba(255,255,255,.12); color: #fff; font-size: 14px; outline: none;
  transition: background .12s;
}
.header-search::placeholder { color: rgba(255,255,255,.78); }
.header-search:focus { background: rgba(255,255,255,.2); }
.header-search:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.search-clear {
  position: absolute; right: 4px; width: 28px; height: 28px; border-radius: 50%;
  color: rgba(255,255,255,.8); display: flex; align-items: center; justify-content: center;
}
.search-clear:hover { background: rgba(255,255,255,.15); color: #fff; }
.search-clear svg { width: 14px; height: 14px; }
.header-right { display: flex; align-items: center; gap: 4px; margin-left: auto; flex-shrink: 0; }
.sync-status { font-size: 12px; font-weight: 600; white-space: nowrap; transition: opacity .3s; padding-right: 8px; color: rgba(255,255,255,.7); }
.sync-status:empty { opacity: 0; }
.sync-status.ok     { color: #a8e07a; }
.sync-status.saving { color: #fcd34d; }
.sync-status.warn   { color: #fcd34d; }
.sync-status.error  { color: #fca5a5; }
.hdr-btn {
  position: relative; width: 38px; height: 38px; border-radius: var(--radius);
  color: rgba(255,255,255,.88); display: flex; align-items: center; justify-content: center;
  transition: background .12s; flex-shrink: 0;
}
.hdr-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
.hdr-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.hdr-btn svg { width: 19px; height: 19px; }
.hdr-btn--active { background: rgba(255,255,255,.16); color: #fff; }
.hdr-btn--primary {
  width: auto; margin-left: 6px; padding: 0 14px 0 10px; gap: 6px;
  background: var(--primary); color: var(--primary-text); font-weight: 700; font-size: 13px;
}
.hdr-btn--primary:hover { background: var(--primary-hover); color: var(--primary-text); }
.hdr-btn-text { white-space: nowrap; }
.reminder-badge {
  position: absolute; top: 3px; right: 3px;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--badge); color: var(--slate-2);
  font-size: 12px; font-weight: 800; line-height: 18px;
  border-radius: 9px; text-align: center; pointer-events: none;
}
.hdr-more-wrap { position: relative; }
.hdr-more { display: none; }
.hdr-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 220px;
  background: var(--white); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg); padding: 6px; display: flex; flex-direction: column;
}
.hdr-menu button { text-align: left; padding: 10px 12px; border-radius: var(--radius); font-size: 14px; font-weight: 600; min-height: 44px; }
.hdr-menu button:hover { background: var(--bg); }

/* ── Offline-Leiste, Neue Version ────────────────────────────── */
.offline-bar { background: var(--yellow-light); color: var(--yellow); font-size: 13px; font-weight: 700; text-align: center; padding: 8px 16px; border-bottom: 1px solid #fde68a; }
.scrm-update {
  position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 400; display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px);
  background: var(--slate); color: #fff; padding: 10px 10px 10px 16px; border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  font-size: 13px; font-weight: 600;
}
.scrm-update-btn { background: var(--primary); color: var(--primary-text); border-radius: var(--radius); padding: 8px 12px; font-weight: 700; white-space: nowrap; }
.scrm-update-btn:hover { background: var(--primary-hover); }
.scrm-update-x { color: #fff; width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--radius); opacity: .8; }
.scrm-update-x:hover { opacity: 1; background: rgba(255,255,255,.12); }

/* ── Wiedervorlage ───────────────────────────────────────────── */
.reminder-panel {
  position: sticky; top: var(--header-h); z-index: 90;
  background: var(--white); border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.reminder-inner { max-width: 860px; margin: 0 auto; padding: 16px 24px; }
.reminder-group-title { font-size: 12px; font-weight: 800; color: var(--text-2); margin: 14px 0 6px; }
.reminder-group-title:first-child { margin-top: 0; }
.reminder-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius); cursor: pointer; transition: background .12s; }
.reminder-row:hover { background: var(--bg); }
.reminder-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.reminder-title { font-size: 13px; font-weight: 700; color: var(--text); flex: 1; }
.reminder-contact { font-size: 12px; color: var(--text-2); }
.reminder-date { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: var(--radius-pill); white-space: nowrap; font-variant-numeric: tabular-nums; }
.reminder-date--overdue { background: var(--red-light); color: var(--red); }
.reminder-date--today   { background: var(--yellow-light); color: var(--yellow); }
.reminder-date--week    { background: var(--primary-light); color: var(--primary-ink); }
.reminder-date--later   { background: var(--bg-2); color: var(--text-2); }
.reminder-empty { font-size: 13px; color: var(--text-2); padding: 8px 0; }

/* ── Bericht ─────────────────────────────────────────────────── */
.report-panel {
  position: sticky; top: var(--header-h); z-index: 90;
  background: var(--white); border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow); padding: 16px 24px;
}
.report-inner { max-width: 900px; margin: 0 auto; }
.report-month { font-size: 15px; font-weight: 800; color: var(--text); margin-bottom: 12px; letter-spacing: -.01em; }
.report-grid { display: flex; gap: 40px; flex-wrap: wrap; }
.report-section { display: flex; flex-direction: column; gap: 6px; }
.report-section-title { font-size: 12px; font-weight: 800; color: var(--text-2); margin-bottom: 2px; }
.report-row { display: flex; align-items: baseline; gap: 10px; }
.report-num { font-size: 22px; font-weight: 800; color: var(--primary-ink); min-width: 40px; text-align: right; line-height: 1; font-variant-numeric: tabular-nums; }
.report-label { font-size: 13px; color: var(--text-2); }
.report-row--sub .report-label { color: var(--text-2); }
.report-num--sub { font-size: 16px; color: var(--text-2); }
.report-row--sep { height: 1px; background: var(--border); margin: 4px 0; }
.report-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 12px; }
.report-month-nav { display: flex; align-items: center; gap: 8px; }
.report-nav-btn {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--white); color: var(--text-2);
  display: flex; align-items: center; justify-content: center; transition: all .12s; flex-shrink: 0;
}
.report-nav-btn:hover { border-color: var(--primary-dark); color: var(--primary-ink); background: var(--primary-light); }
.report-nav-btn svg { width: 16px; height: 16px; }
.report-nav-placeholder { display: inline-block; width: 32px; }
.report-gen-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius-pill);
  border: 1px solid var(--border); background: var(--white);
  color: var(--text-2); font-size: 12px; font-weight: 700;
  transition: all .12s; white-space: nowrap; flex-shrink: 0;
}
.report-gen-btn:hover { border-color: var(--primary-dark); color: var(--primary-ink); background: var(--primary-light); }

/* ── Suche ───────────────────────────────────────────────────── */
.search-results { position: fixed; top: var(--header-h); left: 0; right: 0; bottom: 0; background: var(--bg); z-index: 90; overflow-y: auto; padding: 20px; }
.search-results-inner { max-width: 800px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.search-result-item {
  background: var(--white); border-radius: var(--radius-md); padding: 14px 16px;
  box-shadow: var(--shadow); cursor: pointer; transition: box-shadow .12s;
  display: flex; align-items: flex-start; gap: 12px;
}
.search-result-item:hover { box-shadow: var(--shadow-md); }
.search-result-info { flex: 1; min-width: 0; }
.search-result-title { font-weight: 700; font-size: 14px; margin-bottom: 3px; }
.search-result-title mark { background: #fef08a; color: var(--text); border-radius: 2px; padding: 0 2px; }
.search-result-meta { font-size: 12px; color: var(--text-2); }
.search-result-badge { flex-shrink: 0; padding: 3px 10px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 700; }
.search-empty { text-align: center; color: var(--text-2); padding: 40px 0; font-size: 14px; }

/* ── Toolbar: Filter als Schalterleiste, Ansichts-Umschalter ─── */
.kanban-toolbar {
  min-height: var(--toolbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  background: var(--white); border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none;
}
.kanban-toolbar::-webkit-scrollbar { display: none; }
.tag-filter { display: flex; gap: 2px; align-items: center; flex-wrap: nowrap; background: var(--bg); border-radius: var(--radius-pill); padding: 3px; }
.tag-filter-btn {
  height: 28px; padding: 0 12px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 600;
  color: var(--text-2); white-space: nowrap; transition: background .12s, color .12s;
}
.tag-filter-btn:hover { color: var(--text); }
.tag-filter-btn.active { background: var(--white) !important; color: var(--text) !important; border-color: transparent !important; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.view-toggle { display: flex; align-items: center; gap: 2px; margin-left: auto; flex-shrink: 0; background: var(--bg); border-radius: var(--radius-pill); padding: 3px; }
.view-btn { width: 36px; height: 28px; border-radius: var(--radius-pill); color: var(--text-3); display: flex; align-items: center; justify-content: center; transition: background .12s, color .12s; }
.view-btn:hover { color: var(--text); }
.view-btn--active { background: var(--slate); color: #fff; }
.view-btn svg { width: 15px; height: 15px; }

/* ── Kanban ──────────────────────────────────────────────────── */
.kanban-board {
  display: flex; padding: 14px 8px 16px;
  overflow-x: auto; align-items: flex-start;
  min-height: calc(100vh - var(--header-h) - var(--toolbar-h));
}
.kanban-col { flex: 0 0 280px; padding: 0 10px; display: flex; flex-direction: column; }
.kanban-col + .kanban-col { border-left: 1px solid var(--border); }
.kanban-col-header { display: flex; align-items: center; gap: 8px; padding: 4px 2px 8px; font-size: 14px; font-weight: 800; color: var(--text); letter-spacing: -.01em; }
.kcol-dot { display: none; }
.kcol-title { flex: 1; }
.kcol-sum { font-size: 12px; font-weight: 800; color: var(--primary-ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.kcol-sum--sqm { color: var(--text-3); font-weight: 600; }
.kcol-count { background: var(--bg); color: var(--text-2); border-radius: var(--radius-pill); padding: 2px 9px; font-size: 12px; font-weight: 700; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.kanban-cards { display: flex; flex-direction: column; gap: 10px; min-height: 80px; border-radius: var(--radius-md); transition: background .12s; }
.kanban-cards.drag-over { background: var(--primary-light); }
.kanban-empty { border: 1.5px dashed var(--border-2); border-radius: var(--radius-md); padding: 18px 12px; color: var(--text-3); font-size: 12px; text-align: center; }
.sk-card { height: 86px; border-radius: var(--radius-md); background: linear-gradient(90deg, var(--bg-2) 25%, var(--border) 50%, var(--bg-2) 75%); background-size: 200% 100%; animation: skPuls 1.2s ease-in-out infinite; }
@keyframes skPuls { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.drop-indicator { height: 3px; background: var(--primary); border-radius: 2px; margin: 2px 4px; pointer-events: none; }

.kcard {
  position: relative; background: var(--white); border-radius: var(--radius-md); overflow: hidden;
  cursor: pointer; user-select: none; box-shadow: var(--shadow);
  transition: box-shadow .12s, transform .12s;
}
.kcard::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c, var(--border-2)); z-index: 1; }
.kcard:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kcard.dragging { opacity: .5; transform: rotate(2deg); }
.kcard-hero { width: 100%; height: 100px; object-fit: cover; display: block; }
.kcard-body { padding: 12px 14px 10px 16px; }
.kcard-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 4px; }
.kcard-title { font-size: 14px; font-weight: 800; color: var(--text); line-height: 1.3; letter-spacing: -.01em; }
.kcard-sqm { font-size: 12px; font-weight: 700; color: var(--primary-ink); white-space: nowrap; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.kcard-contact { font-size: 12.5px; color: var(--text-2); margin-bottom: 3px; display: flex; align-items: center; gap: 6px; }
.kcard-due { font-size: 12.5px; color: var(--text-2); margin-bottom: 3px; display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.kcard-due.overdue { color: var(--red); font-weight: 700; }
.ico { width: 14px; height: 14px; flex-shrink: 0; color: var(--text-3); }
.kcard-due.overdue .ico { color: var(--red); }
.kcard-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.kcard-tag { padding: 3px 8px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 700; background: var(--bg); color: var(--text-2); }
.kcard-footer { display: flex; gap: 12px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.kcard-footer span { display: flex; align-items: center; gap: 4px; }

/* ── Toast ───────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: max(24px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  padding: 10px 18px; border-radius: var(--radius); font-size: 13px; font-weight: 600;
  color: #fff; z-index: 9999; animation: toastIn .2s ease; pointer-events: none; max-width: calc(100vw - 32px);
}
.toast.info    { background: var(--slate); }
.toast.success { background: var(--success); }
.toast.error   { background: var(--red); }
.scrm-update ~ .toast { bottom: calc(max(16px, env(safe-area-inset-bottom)) + 72px); } /* nicht unter dem Hinweis zur neuen Version */
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(8px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ── Projekt-Modal ───────────────────────────────────────────── */
.pmodal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: flex-start; justify-content: center; padding-top: 32px; }
.pmodal-backdrop { position: absolute; inset: 0; background: rgba(24,36,42,.45); backdrop-filter: blur(3px); }
.pmodal-panel {
  position: relative; z-index: 1; background: var(--white); border-radius: 16px;
  width: 92%; max-width: 960px; max-height: 88dvh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); animation: popIn .18s ease;
}
@keyframes popIn { from { transform: scale(.97) translateY(8px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }
.pmodal-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px 14px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--white);
  border-radius: 16px 16px 0 0; z-index: 10; flex-shrink: 0;
}
.pmodal-status-badge { padding: 4px 12px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 700; flex-shrink: 0; user-select: none; }
.pmodal-status-badge:hover { filter: brightness(.96); }
.status-dropdown-popup {
  position: fixed; z-index: 9999;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  padding: 6px; display: flex; flex-direction: column; gap: 3px; min-width: 160px;
}
.status-dropdown-item { padding: 7px 12px; border-radius: var(--radius); font-size: 12px; font-weight: 700; text-align: left; transition: filter .1s; }
.status-dropdown-item:hover { filter: brightness(.95); }
.status-dropdown-item.active { outline: 2px solid currentColor; outline-offset: -2px; }
.pmodal-title-display { font-size: 18px; font-weight: 800; flex: 1; color: var(--text); letter-spacing: -.01em; min-width: 0; }
.pmodal-close {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--white); color: var(--text-2); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; transition: all .12s;
}
.pmodal-close:hover { border-color: var(--border-2); color: var(--text); background: var(--bg); }
.pmodal-close svg { width: 16px; height: 16px; }
.pmodal-body { display: grid; grid-template-columns: 1fr 360px; flex: 1; overflow: hidden; }
.pmodal-left { padding: 20px 24px; border-right: 1px solid var(--border); overflow-y: auto; display: flex; flex-direction: column; gap: 0; }
.pmodal-right { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.pmodal-footer { padding: 12px 20px; border-top: 1px solid var(--border); flex-shrink: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pmodal-footer .ptag-wrap { flex: 1; min-width: 0; }
.pmodal-footer-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-left: auto; }
.pmodal-section-title { font-size: 12px; font-weight: 800; color: var(--text-2); margin-bottom: 6px; }
.pmodal-left .pmodal-section-title { margin-top: 18px; }
.pmodal-left .pmodal-section-title:first-child { margin-top: 0; }
.pmodal-field { display: flex; flex-direction: column; gap: 6px; }
.pmodal-field .pmodal-section-title { margin: 0; }

/* ── Eingaben ────────────────────────────────────────────────── */
.p-input, .p-select, .p-textarea {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 14px; color: var(--text); background: var(--white);
  outline: none; transition: border-color .12s, box-shadow .12s;
}
.p-input:focus, .p-select:focus, .p-textarea:focus { border-color: var(--primary-dark); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 32%, transparent); }
.p-textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.p-select { cursor: pointer; }
.contact-fields { display: flex; flex-direction: column; gap: 6px; }
.contact-field-row { display: flex; gap: 6px; }
.contact-field-row .p-input { flex: 1; }
.contact-input-row { display: flex; gap: 6px; align-items: center; }
.contact-input-row .p-input { flex: 1; }
.contact-action {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; flex-shrink: 0;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--primary-light); color: var(--primary-ink);
  text-decoration: none; transition: background .12s, color .12s, border-color .12s;
}
.contact-action:hover { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.contact-action svg { width: 16px; height: 16px; }
.contact-action--hidden { display: none; }
.hero-wrap { display: flex; flex-direction: column; gap: 6px; }
.hero-preview { width: 100%; height: 140px; object-fit: cover; border-radius: var(--radius); cursor: pointer; display: block; border: 1px solid var(--border); transition: border-color .12s; }
.hero-preview:hover { border-color: var(--primary-dark); }
.hero-placeholder {
  width: 100%; height: 100px; border: 1.5px dashed var(--border-2); border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; cursor: pointer; color: var(--text-3); font-size: 12px; font-weight: 600; transition: all .12s;
}
.hero-placeholder:hover { border-color: var(--primary-dark); color: var(--primary-ink); }
.sqm-inline-row { display: flex; align-items: center; gap: 10px; }
.sqm-inline-row .pmodal-section-title { margin: 0; white-space: nowrap; flex-shrink: 0; }
.sqm-inline-input { width: 90px !important; flex-shrink: 0; }
.sqm-manual-input { width: 110px !important; flex-shrink: 0; margin-left: auto; }
.sqm-price-row { display: flex; justify-content: space-between; align-items: baseline; min-height: 16px; }
.sqm-price { font-size: 12px; color: var(--primary-ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.sqm-discount { font-size: 12px; color: var(--yellow); font-weight: 700; }
.mischkalk-wrap { margin-top: 4px; }
.mk-ergebnis { margin-top: 6px; border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; font-size: 12px; }
.mk-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--border); color: var(--text-2); font-variant-numeric: tabular-nums; }
.mk-row:last-child { border-bottom: none; }
.mk-row--total { background: var(--primary-light); font-weight: 800; color: var(--primary-ink); }
.mk-row--total span:last-child { font-size: 13px; }
.mk-hinweis { padding: 8px 10px; font-size: 12px; color: var(--text-2); background: var(--bg); border-radius: var(--radius); }
.due-row { display: flex; gap: 8px; }
.due-row .p-input { flex: 1.4; }
.due-row .p-select { flex: 1; }
.folder-row { display: flex; gap: 6px; align-items: center; }
.folder-row .p-input { flex: 1; }
.folder-open-btn {
  padding: 9px 12px; border-radius: var(--radius); font-size: 13px; font-weight: 700; white-space: nowrap; flex-shrink: 0;
  background: var(--blue-light); color: var(--blue); border: 1px solid #bfdbfe; display: inline-flex; align-items: center; transition: background .12s;
}
.folder-open-btn:hover { background: #dbeafe; }

/* ── Tags, Aufgaben, Kommentare ──────────────────────────────── */
.ptag-wrap { display: flex; flex-wrap: wrap; gap: 5px; }
.ptag {
  display: inline-flex; align-items: center; padding: 4px 11px; border-radius: var(--radius-pill);
  border: 1px solid var(--border); background: var(--white); color: var(--text-2); font-size: 12px; font-weight: 700;
  user-select: none; transition: all .12s;
}
.ptag:hover { border-color: var(--border-2); color: var(--text); }
.task-list { display: flex; flex-direction: column; gap: 4px; }
.task-item { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: var(--radius); transition: background .12s; }
.task-item:hover { background: var(--bg); }
.task-item input[type="checkbox"] { accent-color: var(--primary-dark); width: 16px; height: 16px; flex-shrink: 0; cursor: pointer; }
.task-text { flex: 1; font-size: 14px; border: none; outline: none; background: transparent; }
.task-text.done { text-decoration: line-through; color: var(--text-3); }
.task-item-del { width: 28px; height: 28px; border-radius: 50%; color: var(--text-3); display: flex; align-items: center; justify-content: center; transition: all .12s; flex-shrink: 0; }
.task-item-del:hover { background: var(--red-light); color: var(--red); }
.task-item-del svg { width: 14px; height: 14px; }
.task-add-input { width: 100%; padding: 8px 10px; border: 1px dashed var(--border-2); border-radius: var(--radius); font-size: 14px; outline: none; background: transparent; margin-top: 4px; }
.task-add-input:focus { border-color: var(--primary-dark); background: var(--white); }
.comment-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.comment-item { padding: 10px 12px; background: var(--bg); border-radius: var(--radius-md); }
.comment-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 3px; }
.comment-date { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.comment-edit-btn { width: 28px; height: 28px; border-radius: 50%; color: var(--text-3); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .12s, color .12s, background .12s; }
.comment-item:hover .comment-edit-btn, .comment-edit-btn:focus-visible { opacity: 1; }
.comment-edit-btn:hover { color: var(--primary-ink); background: var(--primary-light); }
.comment-edit-btn svg { width: 14px; height: 14px; }
.comment-text { font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.comment-edit-area {
  width: 100%; padding: 8px 10px; margin-top: 6px; border: 1px solid var(--primary-dark); border-radius: var(--radius);
  font-size: 14px; line-height: 1.5; resize: vertical; outline: none; min-height: 60px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 32%, transparent);
}
.comment-edit-actions { display: flex; gap: 6px; margin-top: 6px; }
.comment-save-btn { padding: 6px 12px; border-radius: var(--radius); font-size: 12px; font-weight: 700; background: var(--primary); color: var(--primary-text); transition: filter .12s; }
.comment-save-btn:hover { filter: brightness(1.05); }
.comment-delete-btn { padding: 6px 10px; border-radius: var(--radius); font-size: 12px; font-weight: 600; border: 1px solid var(--border); color: var(--text-2); transition: all .12s; }
.comment-delete-btn:hover { border-color: var(--red); color: var(--red); background: var(--red-light); }

/* ── Smart-Text-Dialog, Rückfrage, Mail-Dialog ───────────────── */
.smart-dialog-overlay { position: fixed; inset: 0; z-index: 1100; background: rgba(24,36,42,.45); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 16px; }
.smart-dialog-card { background: var(--white); border-radius: 16px; width: 100%; max-width: 480px; padding: 24px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow-lg); max-height: 88dvh; }
.smart-dialog-header { display: flex; align-items: center; justify-content: space-between; }
.smart-dialog-title { font-size: 17px; font-weight: 800; color: var(--text); }
.smart-dialog-close { width: 36px; height: 36px; border-radius: 50%; color: var(--text-2); display: flex; align-items: center; justify-content: center; }
.smart-dialog-close:hover { background: var(--bg); color: var(--text); }
.smart-dialog-close svg { width: 16px; height: 16px; }
.smart-dialog-hint { font-size: 13px; color: var(--text-2); line-height: 1.5; }
.smart-dialog-textarea { width: 100%; resize: vertical; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); outline: none; min-height: 130px; }
.smart-dialog-textarea:focus { border-color: var(--primary-dark); background: var(--white); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 32%, transparent); }
.smart-dialog-actions { display: flex; gap: 10px; justify-content: flex-end; }
.sd-btn { padding: 9px 16px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 700; border: 1px solid transparent; }
.sd-btn--ghost { border-color: var(--border); color: var(--text-2); }
.sd-btn--ghost:hover { border-color: var(--border-2); color: var(--text); }
.sd-btn--primary { background: var(--primary); color: var(--primary-text); }
.sd-btn--primary:hover { background: var(--primary-hover); }
.scrm-frage-wrap { position: fixed; inset: 0; z-index: 1200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.scrm-frage-backdrop { position: absolute; inset: 0; background: rgba(24,36,42,.45); }
.scrm-frage { position: relative; background: var(--white); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 22px; width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 10px; max-height: 88dvh; }
.scrm-frage h2 { font-size: 17px; font-weight: 800; }
.scrm-frage p { font-size: 13px; color: var(--text-2); line-height: 1.5; }
.scrm-frage-fuss { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.mail-dialog-backdrop { position: fixed; inset: 0; z-index: 10000; background: rgba(24,36,42,.45); display: flex; align-items: center; justify-content: center; padding: 20px; }
.mail-dialog-card { background: var(--white); border-radius: 16px; padding: 24px; max-width: 560px; width: 100%; position: relative; box-shadow: var(--shadow-lg); max-height: 88dvh; overflow-y: auto; }
.mail-dialog-close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%; color: var(--text-2); display: flex; align-items: center; justify-content: center; }
.mail-dialog-close:hover { background: var(--bg); color: var(--text); }
.mail-dialog-close svg { width: 16px; height: 16px; }
.mail-dialog-title { margin: 0 0 14px; font-size: 18px; font-weight: 800; color: var(--text); }
.mail-dialog-label { display: block; font-size: 12px; color: var(--text-2); font-weight: 800; margin: 14px 0 6px; }
.mail-dialog-row { display: flex; gap: 8px; align-items: stretch; }
.mail-dialog-row--text { align-items: flex-start; }
.mail-dialog-input, .mail-dialog-textarea { flex: 1; padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--border); font-size: 14px; outline: none; background: var(--white); color: var(--text); }
.mail-dialog-input:focus, .mail-dialog-textarea:focus { border-color: var(--primary-dark); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 32%, transparent); }
.mail-dialog-textarea { resize: vertical; min-height: 240px; line-height: 1.5; }
.mail-dialog-copy { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; background: var(--primary-light); color: var(--primary-ink); border-radius: var(--radius); flex-shrink: 0; transition: background .12s, color .12s; }
.mail-dialog-copy:hover { background: var(--primary); color: var(--primary-text); }
.mail-dialog-copy svg { width: 16px; height: 16px; }

/* ── Anmeldung ───────────────────────────────────────────────── */
.login-overlay { position: fixed; inset: 0; z-index: 9999; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card {
  background: var(--white); border-radius: 20px; border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  padding: 44px 36px 36px; width: 100%; max-width: 380px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.login-icon { width: 76px; height: 76px; border-radius: 18px; box-shadow: var(--shadow); margin-bottom: 10px; }
.login-title { font-size: 26px; font-weight: 800; color: var(--text); margin-bottom: 22px; letter-spacing: -.02em; }
.login-title b { font-weight: 800; color: #7a5c00; }
.login-recht { margin-top: 14px; font-size: 12px; }
.login-form { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.login-input { width: 100%; padding: 12px 16px; border-radius: var(--radius-md); border: 1px solid var(--border); font-size: 16px; outline: none; transition: border-color .12s, box-shadow .12s; }
.login-input:focus { border-color: var(--primary-dark); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 32%, transparent); }
.login-btn { width: 100%; padding: 13px; border-radius: var(--radius-md); background: var(--primary); color: var(--primary-text); font-size: 15px; font-weight: 800; transition: background .12s; }
.login-btn:hover { background: var(--primary-hover); }
.login-btn:disabled { opacity: .6; cursor: default; }
.login-error { font-size: 13px; color: var(--red); text-align: center; background: var(--red-light); border-radius: var(--radius); padding: 8px; font-weight: 600; }
.login-faceid-block, .login-faceid-prompt { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.login-faceid-prompt { text-align: center; }
.login-faceid-prompt-text { font-size: 14px; color: var(--text-2); margin: 4px 0 8px; }
.login-link { color: var(--text-2); font-size: 13px; font-weight: 600; padding: 8px; text-decoration: underline; text-underline-offset: 3px; }
.login-link:hover { color: var(--text); }
.login-form.hidden, .login-faceid-block.hidden, .login-faceid-prompt.hidden, .login-link.hidden { display: none; }

/* ── Tabelle ─────────────────────────────────────────────────── */
.table-view { padding: 16px; min-height: calc(100vh - var(--header-h) - var(--toolbar-h)); }
.tv-wrap { overflow-x: auto; background: var(--white); border-radius: var(--radius-md); box-shadow: var(--shadow); }
.tv-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 800px; }
.tv-th {
  padding: 11px 12px; text-align: left; font-size: 12px; font-weight: 800;
  color: var(--text-2); background: var(--bg);
  border-bottom: 1px solid var(--border);
  cursor: pointer; user-select: none; white-space: nowrap; transition: color .12s;
}
.tv-th[data-col]:hover { color: var(--text); }
.tv-th .ico { width: 12px; height: 12px; vertical-align: -1px; color: var(--text-2); }
.tv-row { cursor: pointer; transition: background .12s; }
.tv-row:hover { background: var(--bg); }
.tv-td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-2); vertical-align: middle; }
.tv-td--title { font-weight: 700; color: var(--text); }
.tv-td--num   { text-align: right; font-weight: 700; color: var(--primary-ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tv-td--date  { white-space: nowrap; color: var(--text-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.tv-overdue   { color: var(--red) !important; font-weight: 700; }
.tv-summary { display: flex; gap: 10px; flex-wrap: wrap; padding: 0 0 12px; }
.tv-sum-item { background: var(--white); border-radius: var(--radius-md); border: 1px solid var(--border); padding: 10px 16px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); }
.tv-sum-item--red .tv-sum-num { color: var(--red); }
.tv-sum-num   { font-size: 20px; font-weight: 800; color: var(--primary-ink); line-height: 1; font-variant-numeric: tabular-nums; }
.tv-sum-label { font-size: 12px; color: var(--text-2); }
.tv-badge { display: inline-block; padding: 3px 10px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 700; white-space: nowrap; }
.tv-empty { padding: 48px; text-align: center; color: var(--text-2); font-size: 14px; }

/* ── Liste ───────────────────────────────────────────────────── */
.list-view { padding: 16px; min-height: calc(100vh - var(--header-h) - var(--toolbar-h)); }
.lv-wrap { display: flex; flex-direction: column; gap: 10px; }
.lv-section { border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow); background: var(--white); }
.lv-header { display: flex; align-items: center; gap: 8px; padding: 11px 14px; background: var(--white); cursor: pointer; user-select: none; border-bottom: 1px solid var(--border); transition: background .12s; }
.lv-header:hover { background: var(--bg); }
.lv-chevron { flex-shrink: 0; color: var(--text-3); transition: transform .2s; }
.lv-chevron--collapsed { transform: rotate(-90deg); }
.lv-status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.lv-status-label { font-size: 14px; font-weight: 800; color: var(--text); flex: 1; }
.lv-count { background: var(--bg); color: var(--text-2); border-radius: var(--radius-pill); padding: 2px 9px; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.lv-sum { font-size: 12px; font-weight: 800; color: var(--primary-ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.lv-sum--sqm { color: var(--text-3); font-weight: 600; }
.lv-rows { background: var(--white); }
.lv-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .12s; }
.lv-row:last-child { border-bottom: none; }
.lv-row:hover { background: var(--bg); }
.lv-row-avatar { flex-shrink: 0; }
.lv-avatar-img { width: 36px; height: 36px; object-fit: cover; border-radius: var(--radius); display: block; border: 1px solid var(--border); }
.lv-avatar-placeholder { width: 36px; height: 36px; border-radius: var(--radius); background: var(--bg); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--text-3); }
.lv-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lv-row-title { font-size: 14px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lv-row-contact { font-size: 12px; color: var(--text-2); }
.lv-row-meta { display: flex; align-items: center; gap: 10px; flex-shrink: 0; font-size: 12px; color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.lv-row-sqm   { font-weight: 700; color: var(--primary-ink); }
.lv-row-due   { display: inline-flex; align-items: center; gap: 4px; }
.lv-row-tasks { display: inline-flex; align-items: center; gap: 4px; }
.lv-overdue   { color: var(--red) !important; font-weight: 700; }
.lv-row-tags { display: flex; gap: 4px; flex-wrap: nowrap; flex-shrink: 0; }
.lv-empty { padding: 14px; font-size: 13px; color: var(--text-2); }

/* ═══════════════════════════════════════════════════════════════
   FLÄCHENPFLEGE, Ansicht pflege.js, alle Klassen mit pf-
═══════════════════════════════════════════════════════════════ */
.pflege-view { padding: 16px; min-height: calc(100vh - var(--header-h) - var(--toolbar-h)); }
.pf-ico { flex-shrink: 0; vertical-align: -2px; }
.pf-toolbar { display: flex; align-items: center; gap: 10px; }
.pf-tb-label { font-size: 12px; color: var(--text-2); font-weight: 700; }
.pf-jahre { display: inline-flex; background: var(--bg); border-radius: var(--radius-pill); padding: 3px; gap: 2px; }
.pf-jahre button { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }
.pf-jahre button:hover { color: var(--text); }
.pf-jahre button.aktiv { background: var(--slate); color: #fff; }
.pf-rot { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 12px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.pf-jahre button.aktiv .pf-rot { background: var(--badge); color: var(--slate-2); }

.pf-sum { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.pf-sum-item { background: var(--white); border-radius: var(--radius-md); border: 1px solid var(--border); padding: 10px 16px; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; box-shadow: var(--shadow); text-align: left; transition: border-color .12s; }
.pf-sum-item:hover { border-color: var(--border-2); }
.pf-sum-item.aktiv { border-color: var(--slate); box-shadow: 0 0 0 1px var(--slate); }
.pf-sum-num { font-size: 20px; font-weight: 800; line-height: 1; color: var(--text); font-variant-numeric: tabular-nums; }
.pf-sum-label { font-size: 12px; color: var(--text-2); }
.pf-sum-item--red .pf-sum-num { color: var(--red); }
.pf-sum-item--yellow .pf-sum-num { color: var(--yellow); }
.pf-sum-item--green .pf-sum-num, .pf-sum-item--green2 .pf-sum-num { color: var(--success); }

.pf-bulk { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; background: var(--slate); color: #fff; border-radius: var(--radius-md); padding: 10px 14px; margin-bottom: 12px; font-size: 13px; position: sticky; top: var(--header-h); z-index: 20; box-shadow: var(--shadow-md); }
.pf-bulk label { display: inline-flex; align-items: center; gap: 6px; }
.pf-bulk input, .pf-bulk select { padding: 5px 8px; border-radius: var(--radius); border: none; font-size: 13px; }
.pf-bulk .btn-ghost { background: rgba(255,255,255,.12); border-color: transparent; color: #fff; }
.pf-bulk .btn-ghost:hover { background: rgba(255,255,255,.2); }
.pf-bulk-sep { width: 1px; height: 22px; background: rgba(255,255,255,.25); }

.pf-table { min-width: 0; }
.pf-table .tv-th { cursor: default; }
.pf-table .tv-th:hover { color: var(--text-2); }
.pf-table .tv-td { white-space: nowrap; padding-left: 6px; padding-right: 6px; }
.pf-table .tv-th { padding-left: 6px; padding-right: 6px; }
.pf-table .pf-sortbar { cursor: pointer; }
.pf-objnr { font-variant-numeric: tabular-nums; letter-spacing: .3px; }
.pf-objekt-input { width: 80px; padding: 4px 6px; border: 1px solid var(--primary-dark); border-radius: var(--radius); font-size: 13px; font-variant-numeric: tabular-nums; }
.pf-sort { display: inline-flex; align-items: center; gap: 3px; font: inherit; color: inherit; white-space: nowrap; }
.pf-table .pf-sortbar:hover, .pf-table .pf-sortiert { color: var(--text); }
.pf-row:hover { background: var(--bg); }
.pf-cbz { width: 34px; padding-right: 0 !important; border-left: 4px solid transparent; }
.pf-cb { width: 16px; height: 16px; accent-color: var(--primary-dark); cursor: pointer; vertical-align: middle; }
.pf-row--red .pf-cbz { border-left-color: var(--red); }
.pf-row--yellow .pf-cbz { border-left-color: var(--amber); }
.pf-row--green2 .pf-cbz, .pf-row--green .pf-cbz { border-left-color: var(--success); }
.pf-row--blue .pf-cbz { border-left-color: var(--slate-light); }
.pf-table .pf-kunde { white-space: normal; min-width: 100px; max-width: 200px; overflow-wrap: break-word; }
.pf-name { display: block; font-weight: 700; color: var(--text); font-size: 13px; text-align: left; }
.pf-name:hover { color: var(--primary-ink); text-decoration: underline; }
.pf-ort { display: block; font-size: 12px; color: var(--text-3); }
.pf-num { text-align: right !important; font-variant-numeric: tabular-nums; }
.pf-n { display: block; margin-top: 3px; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.pf-datum { font-variant-numeric: tabular-nums; color: var(--text-2) !important; font-size: 12px !important; }
.pf-nr { display: block; font-size: 12px; color: var(--text-3); }
.pf-row--raus .tv-td { color: var(--text-3); background: var(--bg); }
.pf-row--raus .pf-name { color: var(--text-2); font-weight: 600; }
.pf-raus-kopf td { padding: 0; border-bottom: 1px solid var(--border); }
.pf-raus-knopf { width: 100%; display: flex; align-items: center; gap: 8px; padding: 11px 14px; font-size: 12px; font-weight: 700; color: var(--text-2); text-align: left; }
.pf-raus-knopf:hover { background: var(--bg); }
.pf-raus-knopf.offen .pf-ico { transform: rotate(180deg); }
.pf-leer { padding: 40px; text-align: center; color: var(--text-2); }
.pf-table .pf-row--summe .tv-td { background: var(--bg); border-bottom: 2px solid var(--border); font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; vertical-align: top; padding-top: 11px; padding-bottom: 11px; }
.pf-row--summe:hover { background: none; }
.pf-summe-titel { display: block; font-weight: 800; }
.pf-sum-klein { display: block; font-size: 12px; font-weight: 500; color: var(--text-3); margin-top: 2px; }

.pf-vl { display: inline-flex; gap: 3px; vertical-align: middle; }
.pf-vl-t { width: 13px; height: 13px; border-radius: 3px; border: 1.5px solid var(--border-2); background: var(--white); }
.pf-vl-t--green { background: var(--success); border-color: var(--success); }
.pf-vl-t--green2 { background: var(--success-light); border-color: var(--success); }
.pf-vl-t--blue { background: #f1f5f9; border-color: var(--slate-light); }
.pf-vl-t--yellow { background: #fde9b8; border-color: var(--amber); }
.pf-vl-t--red { background: #fecaca; border-color: var(--red); }
.pf-vl-t--grey { border-color: #9aa6ad; background: linear-gradient(to top right, transparent 44%, #9aa6ad 44%, #9aa6ad 56%, transparent 56%), var(--bg); }
.pf-vl-t--grey2 { border-style: dotted; background: transparent; }
.pf-vl-t--fokus { box-shadow: 0 0 0 1.5px var(--white), 0 0 0 2.5px var(--text-2); }

.pf-st { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 700; white-space: nowrap; }
.pf-st-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pf-st--red { background: var(--red-light); color: var(--red); }
.pf-st--yellow { background: var(--yellow-light); color: var(--yellow); }
.pf-st--yellow .pf-st-dot { background: var(--amber); }
.pf-st--blue { background: #f1f5f9; color: #475569; }
.pf-st--blue .pf-st-dot { background: var(--slate-light); }
.pf-st--green2 { background: var(--success-light); color: var(--success); }
.pf-st--green { background: var(--success); color: #fff; }
.pf-st--grey, .pf-st--grey2, .pf-st--none { background: var(--bg); color: var(--text-2); }
.pf-st-info { display: block; font-size: 12px; color: var(--text-3); margin-top: 3px; }
.pf-tel { display: flex; align-items: center; gap: 5px; margin-top: 4px; font-size: 12px; font-weight: 700; color: var(--text); text-decoration: none; }
.pf-tel:hover { color: var(--primary-ink); }
.pf-status .pf-mk { margin-top: 5px; }

.pf-mk { display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: var(--radius-pill); border: 1px solid var(--border); background: var(--white); color: var(--text-2); font-size: 12px; font-weight: 700; white-space: nowrap; transition: background .12s, border-color .12s, color .12s; }
.pf-mk + .pf-mk { margin-left: 4px; }
.pf-mk:hover { border-color: var(--primary-dark); color: var(--primary-ink); background: var(--primary-light); }
.pf-mk--pri { border-color: var(--primary-dark); color: var(--primary-ink); }
.pf-mk--pri:hover { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.pf-mk--nein:hover { border-color: var(--red); color: var(--red); background: var(--red-light); }
.pf-mk--ico { padding: 5px 7px; color: var(--text-3); }
.pf-mk:disabled { opacity: .45; cursor: not-allowed; }
.pf-mk:disabled:hover { border-color: var(--border); color: var(--text-2); background: var(--white); }
.pf-dz { font-variant-numeric: tabular-nums; color: var(--text); font-size: 13px; padding: 2px 5px; margin: -2px -5px; border-radius: 4px; }
.pf-dz:hover { background: var(--primary-light); color: var(--primary-ink); }
.pf-dz-input { padding: 4px 6px; border: 1px solid var(--primary-dark); border-radius: var(--radius); font-size: 13px; }
.pf-ja { display: inline-flex; align-items: center; gap: 4px; color: var(--success); font-weight: 700; font-size: 12px; margin-right: 6px; vertical-align: middle; }
.pf-x { margin-left: 6px; padding: 4px; border-radius: 50%; color: var(--text-3); vertical-align: middle; }
.pf-x:hover { background: var(--red-light); color: var(--red); }
.pf-preis { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--text); padding: 2px 5px; margin: -2px -5px; border-radius: 4px; text-align: right; }
.pf-preis:hover { background: var(--primary-light); color: var(--primary-ink); }
.pf-preis--vorschlag { color: var(--text-3); }
.pf-betrag { display: block; }
.pf-satz { display: block; font-size: 12px; color: var(--text-3); }
.pf-misch { display: block; font-size: 12px; color: var(--text-3); white-space: nowrap; max-width: 124px; margin-left: auto; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
@media (max-width: 860px) { .pf-misch br { display: none; } }
.pf-einst { width: 36px; padding-left: 4px !important; padding-right: 0 !important; }

.pf-dialog-wrap { position: fixed; inset: 0; z-index: 1150; display: flex; align-items: center; justify-content: center; padding: 16px; }
.pf-dialog-backdrop { position: absolute; inset: 0; background: rgba(24,36,42,.45); }
.pf-dialog { position: relative; background: var(--white); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 22px; width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 12px; max-height: 88dvh; }
.pf-dialog h2 { font-size: 17px; font-weight: 800; }
.pf-dialog label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 700; color: var(--text-2); }
.pf-dialog input[type=text], .pf-dialog input[type=password], .pf-dialog input[type=number], .pf-dialog input[type=date] { padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; outline: none; }
.pf-dialog input:focus { border-color: var(--primary-dark); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 32%, transparent); }
.pf-dialog .pf-dialog-cb { flex-direction: row; align-items: center; gap: 8px; font-size: 13px; color: var(--text); }
.pf-dialog-hinweis { font-size: 12px; color: var(--text-2); line-height: 1.45; }
.pf-dialog-warn { font-size: 12px; color: var(--yellow); background: var(--yellow-light); border-radius: var(--radius); padding: 7px 10px; }
.pf-dialog-fuss { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.ico-lex { fill: var(--lexware); color: var(--lexware); }
.pf-lex { gap: 3px; }
@media (min-width: 861px) { .pf-table .pf-lexz { width: 1%; } }
.pf-lex-link { display: inline-flex; align-items: center; gap: 3px; color: var(--text-2); text-decoration: none; padding: 5px 7px; border-radius: var(--radius-pill); border: 1px solid transparent; }
.pf-lex-link:hover { border-color: var(--border-2); background: var(--bg); color: var(--text); }
.pf-dialog--breit { max-width: 480px; overflow-y: auto; }
.pf-lex-body { display: flex; flex-direction: column; gap: 10px; }
.pf-lex-kontakte { display: flex; flex-direction: column; gap: 6px; }
.pf-dialog .pf-lex-k { flex-direction: row; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--text); padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; }
.pf-dialog .pf-lex-k:has(input:checked) { border-color: var(--primary-dark); background: var(--primary-light); }
.pf-lex-tag { font-size: 12px; font-weight: 700; color: var(--text-2); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 0 7px; margin-left: 4px; }
.pf-lex-vorh { font-size: 12px; color: var(--yellow); background: var(--yellow-light); border-radius: var(--radius); padding: 7px 10px; margin: -2px 0 2px 26px; line-height: 1.5; }
.pf-lex-vorh-akt { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.pf-lex-vorh--fremd { color: var(--text-2); background: var(--bg); }
.pf-lexz .pf-x { margin-left: 2px; }
.pf-lex-vorh-akt a { color: var(--text); font-weight: 700; }
.pf-lex-suche { display: flex; gap: 6px; }
.pf-lex-suche input { flex: 1; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; outline: none; }
.pf-lex-suche input:focus { border-color: var(--primary-dark); }
.pf-lex-summe { font-size: 13px; color: var(--text); background: var(--bg); border-radius: var(--radius); padding: 8px 10px; line-height: 1.5; }

/* html und body sind 100 % hoch. Die haftende App-Kopfzeile bleibt deshalb nur eine Fensterhöhe
   lang oben und scrollt bei langen Seiten danach weg. In der Flächenpflege (lange Tabelle, darunter
   haftende Zeilen) darf body mitwachsen, damit die Kopfzeile oben bleibt. */
body.pflege-aktiv { height: auto; min-height: 100%; }

/* Breit: Kopf- und Summenzeile haften beim Scrollen unter der App-Kopfzeile (und unter der
   Massenleiste, falls offen). pf-fest setzt pflegeLayout() nur, wenn die Tabelle in die Breite passt. */
@media (min-width: 861px) {
  .pflege-view .tv-wrap.pf-fest { overflow: visible; }
  .pf-fest .pf-table { border-collapse: separate; border-spacing: 0; }
  .pf-fest .pf-table thead th { position: sticky; top: calc(var(--header-h) + var(--pf-bulk-h, 0px)); z-index: 12; }
  .pf-fest .pf-table thead th:first-child { border-top-left-radius: var(--radius-md); }
  .pf-fest .pf-table thead th:last-child { border-top-right-radius: var(--radius-md); }
  .pf-fest .pf-table .pf-row--summe .tv-td { position: sticky; top: calc(var(--header-h) + var(--pf-bulk-h, 0px) + var(--pf-th-h, 40px)); z-index: 11; box-shadow: 0 3px 4px -3px rgba(0,0,0,.12); }
}

/* Schmal: jede Zeile wird eine Karte */
@media (max-width: 860px) {
  .pflege-view { padding: 10px; }
  .pflege-view .tv-wrap { background: none; box-shadow: none; overflow: visible; }
  .pf-table thead { display: none; }
  .pf-table, .pf-table tbody { display: block; }
  .pf-row { display: grid; grid-template-columns: auto auto 1fr auto; gap: 2px 10px; background: var(--white); border-radius: var(--radius-md); box-shadow: var(--shadow); margin-bottom: 10px; padding: 12px 14px; border-left: 4px solid transparent; }
  .pf-row--red { border-left-color: var(--red); }
  .pf-row--yellow { border-left-color: var(--amber); }
  .pf-row--green2, .pf-row--green { border-left-color: var(--success); }
  .pf-row--blue { border-left-color: var(--slate-light); }
  .pf-row .tv-td { border: none; padding: 3px 0; white-space: normal; background: none; }
  .pf-row .pf-cbz { grid-column: 1; grid-row: 1; width: auto; border-left: none; }
  .pf-row .pf-cbz:empty { display: none; }
  .pf-row .pf-einst { grid-column: 2; grid-row: 1; width: auto; padding: 0 !important; align-self: start; }
  .pf-row .pf-kunde { grid-column: 3; grid-row: 1; }
  .pf-row .pf-status { grid-column: 4; grid-row: 1; text-align: right; }
  .pf-row .tv-td[data-l] { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 32px; border-top: 1px solid var(--border); padding: 5px 0; flex-wrap: wrap; }
  .pf-row .tv-td[data-l]::before { content: attr(data-l); font-size: 12px; color: var(--text-3); }
  .pf-row .tv-td[data-l]:empty { display: none; }
  .pf-row .pf-st-info { display: none; }
  .pf-row--summe { background: var(--bg); border-left-color: var(--text-3); }
  .pf-table .pf-row--summe .tv-td { background: none; border-bottom: none; padding-top: 3px; padding-bottom: 3px; }
  .pf-table .pf-row--summe .tv-td[data-l] { border-top: 1px solid var(--border); padding: 5px 0; }
  .pf-row--summe .tv-td:empty { display: none; }
  .pf-row--summe .pf-sum-klein { display: inline; margin-left: 8px; }
  .pf-row .pf-tel { justify-content: flex-end; }
  .pf-raus-kopf { display: block; background: var(--white); border-radius: var(--radius-md); box-shadow: var(--shadow); margin-bottom: 10px; }
  .pf-raus-kopf td { display: block; border: none; }
  .pf-bulk { position: static; }
  .pf-bulk-sep { display: none; }
  .pf-mk { padding: 7px 12px; }
}

/* ── Bedienbarkeit ────────────────────────────── */
:focus-visible { outline: 2px solid var(--primary-dark); outline-offset: 2px; }
.kcard:focus-visible, .lv-row:focus-visible, .reminder-row:focus-visible, .search-result-item:focus-visible { outline-offset: -2px; }
body.scrm-dialog-offen { overflow: hidden; }
@media (hover: none) { .comment-edit-btn { opacity: 1; } }
@media (hover: none) and (pointer: coarse) {
  input, select, textarea, .p-input, .header-search, .task-add-input, .smart-dialog-textarea, .pf-dialog input, .pf-dz-input, .pf-objekt-input, .pf-bulk input, .mail-dialog-input, .mail-dialog-textarea { font-size: 16px; }
  .search-clear, .task-item-del, .comment-edit-btn, .pmodal-close, .btn-icon, .hdr-btn, .view-btn, .report-nav-btn, .pf-x, .pf-mk, .mail-dialog-copy, .mail-dialog-close, .smart-dialog-close, .contact-action, .btn-cal-load, .btn-delete, .btn-mail, .btn-lexware, .scrm-update-x, .comment-save-btn, .comment-delete-btn, .login-link, .report-gen-btn, .pf-lex-link, .lv-header, .tv-row { min-width: 44px; min-height: 44px; }
  .tag-filter-btn, .ptag, .pf-dz, .status-dropdown-item, .pf-jahre button { min-height: 44px; display: inline-flex; align-items: center; }
  /* Kopfzellen bleiben Tabellenzellen (display: inline-flex zerlegte auf dem iPad die ganze Tabelle):
     das 44-px-Ziel kommt über das Padding der Zelle und den Sortierknopf darin. */
  .tv-th { padding-top: 14px; padding-bottom: 14px; }
  .tv-th .pf-sort { min-height: 28px; }
  .pf-cb, .task-item input[type=checkbox] { width: 22px; height: 22px; }
}
.app-header { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.kanban-toolbar { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.kanban-board, .list-view, .table-view, .pflege-view { padding-bottom: max(16px, env(safe-area-inset-bottom)); }

/* ── Mobil ───────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .pmodal-body { grid-template-columns: 1fr; overflow-y: auto; overflow-x: hidden; }
  .pmodal-left { border-right: none; border-bottom: 1px solid var(--border); overflow-y: visible; max-height: none; }
  .pmodal-right { overflow-y: visible; }
}
@media (max-width: 640px) {
  .app-header { gap: 8px; }
  .header-left { padding: 2px 5px; }
  .header-logo { height: 24px; }
  .header-search-wrap { max-width: none; }
  .sync-status { display: none; }
  .hdr-btn { width: 42px; height: 42px; }
  .hdr-sec { display: none; }
  .hdr-more { display: flex; }
  .hdr-btn--primary { width: 42px; padding: 0; margin-left: 2px; }
  .hdr-btn-text { display: none; }
  .kanban-toolbar { display: flex; }
  .view-toggle { order: -1; margin-left: 0; margin-right: 6px; }
  .kanban-board { scroll-snap-type: x mandatory; }
  .kanban-col { flex: 0 0 86vw; scroll-snap-align: start; }
  .pmodal { padding-top: 0; align-items: flex-end; }
  .pmodal-panel { width: 100%; max-width: 100%; max-height: 94dvh; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .pmodal-header { border-radius: 16px 16px 0 0; }
  .pmodal-footer .ptag-wrap { flex-basis: 100%; }
  .pmodal-left, .pmodal-right { padding: 16px; }
}

/* ── Weniger Bewegung, wenn das System es wünscht ─────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ── Flächenpflege: Spalten, die der Betrieb abgeschaltet hat ── */
.pf-ohne-nr .pf-objekt, .pf-ohne-lex .pf-lexz { display: none; }

/* ── Einstellungen ───────────────────────────────────────────── */
.es-seite { max-width: 780px; margin: 0 auto; padding: 24px max(16px, env(safe-area-inset-right)) max(60px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); display: flex; flex-direction: column; gap: 28px; }
.es-seite h2 { font-size: 17px; font-weight: 800; margin-bottom: 10px; }
.es-kasten { background: var(--white); border-radius: var(--radius-md); box-shadow: var(--shadow); padding: 6px 16px; }
.es-zeile { display: flex; align-items: center; gap: 12px; padding: 9px 0; min-height: 54px; }
.es-zeile + .es-zeile, .es-tab + .es-zeile { border-top: 1px solid var(--border); }
.es-zeile--hoch { align-items: flex-start; }
.es-zeile--hoch label { padding-top: 9px; }
.es-zeile > label, .es-name { flex: 1; min-width: 120px; font-weight: 600; }
.es-zeile .es-feld { width: 280px; max-width: 100%; }
.es-zeile .es-text { width: 440px; max-width: 100%; resize: vertical; line-height: 1.5; }
.es-feld.es-kurz { width: 96px; text-align: right; font-variant-numeric: tabular-nums; }
.es-feld.es-falsch { border-color: var(--red); }
.es-zeile input[type=color] { width: 56px; height: 38px; border: 1px solid var(--border-2); border-radius: var(--radius); background: var(--white); padding: 3px; cursor: pointer; }
.es-logo { height: 34px; max-width: 160px; object-fit: contain; border: 1px solid var(--border); border-radius: var(--radius); padding: 3px 6px; }
.es-hinweis { padding: 20px 16px; color: var(--text-2); font-weight: 600; }
.es-stand { font-size: 13px; font-weight: 700; color: var(--text-3); }
.es-stand--ok { color: var(--success); }
.es-platzhalter { min-height: 0; padding: 8px 0 12px; font-size: 12px; color: var(--text-3); word-spacing: .3em; }
.es-tab { width: 100%; border-collapse: collapse; }
.es-tab th { text-align: left; font-size: 12px; font-weight: 700; color: var(--text-3); padding: 12px 8px 6px 0; }
.es-tab td { padding: 6px 8px 6px 0; border-top: 1px solid var(--border); vertical-align: middle; }
.es-tab td .es-feld { width: 100%; }
.es-tab td .es-feld.es-kurz { width: 96px; }
.es-tab .es-weg { width: 34px; padding-right: 0; text-align: right; }
.es-schritte { padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); }
.es-schritte a { color: var(--primary-ink); font-weight: 700; }
.es-meldung { font-size: 13px; font-weight: 700; min-height: 0; }
.es-meldung:empty { display: none; }
.es-meldung--fehler { color: var(--red); }
.pf-dialog select { padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; background: var(--white); }
@media (max-width: 640px) {
  .es-zeile { flex-wrap: wrap; }
  .es-zeile .es-feld, .es-zeile .es-text { width: 100%; }
  .es-tab td .es-feld.es-kurz { width: 72px; }
  .header-name { max-width: 34vw; }
}
