/* =========================================================
   KS CRM — interaktive Vorschau im Hero der Startseite.
   Nachbau des Lead-Dialogs aus dem CRM; Werte stammen aus
   Main/src/app/globals.css und den Tailwind-Klassen von
   unified-detail-view, business-process-flow, tasks-widget,
   notes-widget und floating-field. Alles ist unter .crm gekapselt.
   ========================================================= */

.crm {
  --bg: #f7f7f7;
  --card: #fff;
  --fg: oklch(0.18 0.015 260);
  --muted: oklch(0.955 0.005 260);
  --mfg: oklch(0.52 0.01 260);
  --secondary: oklch(0.965 0.005 260);
  --border: oklch(0.915 0.005 260);
  --primary: oklch(0.50 0.22 265);
  --destructive: oklch(0.58 0.20 25);
  --indigo-50: #eef2ff; --indigo-100: #e0e7ff; --indigo-500: #6366f1; --indigo-600: #4f46e5; --indigo-700: #4338ca;
  --amber-100: #fef3c7; --amber-500: #f59e0b; --amber-600: #d97706; --amber-700: #b45309;
  --green-100: #dcfce7; --green-600: #16a34a;
  --purple-100: #f3e8ff; --purple-600: #9333ea;
  --blue-100: #dbeafe; --blue-600: #2563eb;
  --radius: 10px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  position: relative;
  display: flex; flex-direction: column;
  height: 640px;
  overflow: hidden;
  background: var(--card);
  color: var(--fg);
  font-family: "Poppins", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px; line-height: 20px;
  font-feature-settings: normal;
  text-align: left;
  -webkit-font-smoothing: antialiased;
}
/* Grundstile mit Spezifität 0,0,1: jede Klasse unten gewinnt, die Seiten-Stile
   für h2–h4 aus site.css werden trotzdem überschrieben (später geladen). */
.crm *, .crm *::before, .crm *::after { box-sizing: border-box; }
:where(.crm) :is(h2, h3, h4) { margin: 0; font-family: inherit; color: inherit; font-weight: 600; text-wrap: wrap; }
:where(.crm) p { margin: 0; text-wrap: wrap; }
:where(.crm) button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-align: inherit; }
:where(.crm) :is(input, select, textarea) { font-family: inherit; color: inherit; margin: 0; }
:where(.crm) svg { display: block; flex: none; }
.crm :focus-visible { outline: 2px solid color-mix(in oklab, var(--primary) 55%, transparent); outline-offset: 1px; border-radius: 8px; }
.crm .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.crm-scroll { scrollbar-width: thin; scrollbar-color: oklch(0.85 0.005 260) transparent; }

/* ── Buttons wie shadcn/ui im CRM ───────────────────────── */
.crm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 16px; border-radius: 8px; font-size: 14px; font-weight: 500; white-space: nowrap; transition: background-color .15s, border-color .15s, color .15s, opacity .15s; }
.crm-btn.sm { height: 32px; padding: 0 12px; }
.crm-btn.primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .05); }
.crm-btn.primary:hover { background: color-mix(in oklab, var(--primary) 90%, transparent); }
.crm-btn.outline { background: var(--card); border: 1px solid var(--border); box-shadow: 0 1px 2px rgb(0 0 0 / .04); }
.crm-btn.outline:hover { background: var(--muted); }
.crm-btn.ghost:hover { background: var(--muted); }
.crm-btn:disabled { opacity: .5; pointer-events: none; }

.crm-ib { width: 36px; height: 36px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: var(--mfg); transition: background-color .15s, color .15s; }
.crm-ib:hover { background: var(--muted); }
.crm-ib.zap:hover, .crm-ib.zap[aria-expanded="true"] { color: var(--amber-600); }
.crm-ib.ind:hover, .crm-ib.ind[aria-expanded="true"] { color: var(--indigo-600); }
.crm-ib.del { color: var(--destructive); }
.crm-ib.del:hover { background: color-mix(in oklab, var(--destructive) 10%, transparent); }
.crm-ib.close:hover { color: var(--fg); }
.crm-ib.save { background: var(--indigo-600); color: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .05); }
.crm-ib.save:hover { background: var(--indigo-700); }

/* ── Kopfbereich ────────────────────────────────────────── */
.crm-head { flex: none; padding: 8px 16px; border-bottom: 1px solid var(--border); background: var(--card); }
.crm-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.crm-head-title { min-width: 0; }
.crm-title { font-size: 18px; line-height: 1.25; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-sub { display: flex; align-items: center; gap: 8px; margin-top: 4px; min-width: 0; }
.crm-num { flex: none; font: 700 12px/16px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .1em; padding: 2px 8px; border-radius: 4px; border: 1px solid var(--indigo-100); background: var(--indigo-50); color: var(--indigo-600); }
.crm-desc { font-size: 14px; color: var(--mfg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.crm-anchor { position: relative; }

/* ── Prozessleiste (BusinessProcessFlow) ────────────────── */
.crm-bpf { --c: #3b82f6; display: flex; padding: 6px 16px 2px; margin-top: 4px; }
.crm-step { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.crm-step-row { position: relative; width: 100%; height: 32px; display: flex; align-items: center; justify-content: center; }
.crm-line { position: absolute; top: 50%; height: 2px; margin-top: -1px; }
.crm-line.l { left: 0; right: 50%; }
.crm-line.r { left: 50%; right: 0; }
.crm-line::before { content: ""; position: absolute; inset: 0; border-bottom: 2px dashed var(--c); opacity: .3; transition: border-color .5s; }
.crm-line::after { content: ""; position: absolute; inset: 0; background: var(--c); transform: scaleX(0); transform-origin: left center; transition: transform .45s var(--ease), background-color .5s; }
.crm-line.on::after { transform: scaleX(1); }
.crm-node {
  position: relative; z-index: 1; width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--card);
  border: 2px solid color-mix(in oklab, var(--muted) 60%, transparent);
  transition: background-color .3s, border-color .3s, transform .3s var(--ease), box-shadow .3s;
}
.crm-node:hover { transform: scale(1.1); }
.crm-node .dot { width: 6px; height: 6px; border-radius: 50%; background: color-mix(in oklab, var(--mfg) 30%, transparent); }
.crm-node.done { border-color: var(--muted); background: color-mix(in oklab, var(--muted) 40%, var(--card)); box-shadow: 0 1px 2px rgb(0 0 0 / .05); color: var(--mfg); }
.crm-node.current { border-color: transparent; background: var(--c); transform: scale(1.1); box-shadow: 0 0 14px color-mix(in srgb, var(--c) 33%, transparent), 0 0 0 4px color-mix(in srgb, var(--c) 13%, transparent); cursor: default; }
.crm-node.current .dot { width: 10px; height: 10px; background: #fff; animation: crm-pulse 2s cubic-bezier(.4, 0, .6, 1) infinite; }
.crm-node.end { border-style: dashed; color: color-mix(in oklab, var(--mfg) 40%, transparent); }
.crm-node.end:hover, .crm-node.end[aria-expanded="true"] { border-color: color-mix(in oklab, var(--primary) 60%, transparent); }
.crm-node.final { width: 36px; height: 36px; border: 0; transform: scale(1.1); background: var(--c); color: #fff; box-shadow: 0 0 14px color-mix(in srgb, var(--c) 33%, transparent), 0 0 0 4px color-mix(in srgb, var(--c) 13%, transparent); cursor: default; }
.crm-step-label { margin-top: 8px; padding: 2px 6px; border-radius: 999px; font-size: 10px; line-height: 14px; font-weight: 500; white-space: nowrap; color: color-mix(in oklab, var(--mfg) 50%, transparent); transition: color .3s; }
.crm-step-label.done { color: var(--mfg); }
.crm-step-label.current { color: var(--fg); font-weight: 600; }
.crm-step-label.final { font-weight: 600; color: var(--c); }
@keyframes crm-pulse { 50% { opacity: .5; } }
/* Symbole in den Knoten je nach Zustand */
.crm-node .ck, .crm-node .fl, .crm-node .tr, .crm-node .xx { display: none; }
.crm-node.done .ck { display: block; }
.crm-node.done .dot { display: none; }
.crm-node.end .fl { display: block; }
.crm-node.final.won .tr, .crm-node.final.lost .xx { display: block; }
.crm-node.final:hover { transform: scale(1.1); }

/* ── Popover & Menüs ────────────────────────────────────── */
.crm-pop {
  position: absolute; z-index: 30;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);
  animation: crm-pop-in .16s var(--ease);
}
.crm-pop[hidden] { display: none; }
@keyframes crm-pop-in { from { opacity: 0; transform: translateY(-4px) scale(.97); } }
.crm-menu { top: calc(100% + 4px); right: 0; width: 256px; padding: 4px; }
.crm-menu-label { padding: 6px 8px; font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--mfg); }
.crm-menu-item { width: 100%; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; font-size: 14px; line-height: 20px; }
.crm-menu-item:hover, .crm-menu-item:focus-visible { background: var(--muted); outline: none; }
.crm-menu-item svg { color: var(--amber-500); }
.crm-menu-note { margin: 4px 4px 2px; padding: 8px 8px 4px; border-top: 1px solid var(--border); font-size: 11px; line-height: 15px; color: var(--mfg); }

.crm-hist { top: calc(100% + 4px); right: 0; width: 320px; padding: 12px; }
.crm-hist h4 { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.crm-hist ol { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.crm-hist li { display: grid; grid-template-columns: 10px 1fr; gap: 10px; font-size: 13px; line-height: 18px; }
.crm-hist li::before { content: ""; width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: color-mix(in oklab, var(--primary) 20%, var(--card)); border: 2px solid var(--primary); }
.crm-hist small { display: block; font-size: 11px; color: var(--mfg); }

.crm-term-pop { top: calc(100% + 10px); left: 50%; transform: translateX(-50%); padding: 12px; box-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1); animation: crm-pop-in-c .16s var(--ease); }
@keyframes crm-pop-in-c { from { opacity: 0; transform: translateX(-50%) translateY(-4px) scale(.97); } }
.crm-term-pop p { margin-bottom: 8px; text-align: center; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--mfg); }
.crm-term-opts { display: flex; gap: 8px; }
.crm-term-opt { --o: #22c55e; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 80px; padding: 12px 16px; border-radius: 12px; border: 2px solid color-mix(in srgb, var(--o) 33%, transparent); background: color-mix(in srgb, var(--o) 6%, var(--card)); transition: background-color .2s, border-color .2s, transform .2s; }
.crm-term-opt:hover, .crm-term-opt:focus-visible { background: color-mix(in srgb, var(--o) 13%, var(--card)); border-color: var(--o); transform: scale(1.05); outline: none; }
.crm-term-opt.lost { --o: #ef4444; }
.crm-term-opt span:first-child { width: 32px; height: 32px; border-radius: 50%; background: var(--o); color: #fff; display: flex; align-items: center; justify-content: center; }
.crm-term-opt span:last-child { font-size: 12px; font-weight: 600; color: var(--o); }

/* ── Rumpf: Formular links, Widgets rechts ──────────────── */
.crm-tabs { display: none; }
.crm-body { flex: 1; min-height: 0; display: flex; margin-top: 10px; }
.crm-main { flex: 1; min-width: 0; overflow-y: auto; padding: 0 16px 24px 24px; border-right: 1px solid var(--border); }
.crm-side { flex: none; width: 400px; overflow-y: auto; padding: 0 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; }

.crm-sec-title { font-size: 16px; line-height: 24px; font-weight: 600; padding: 4px 0 10px 16px; margin: 0 -16px 16px 0; border-bottom: 1px solid var(--border); }
.crm-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 0 16px; }

/* Feld mit schwebender Beschriftung (FloatingField) */
.crm-ff { position: relative; }
.crm-ff > label { position: absolute; left: 12px; top: 6px; z-index: 1; font-size: 11px; line-height: 1; font-weight: 500; color: var(--mfg); pointer-events: none; transition: color .15s; }
.crm-ff:focus-within > label { color: var(--primary); }
.crm-input {
  width: 100%; height: 48px; padding: 18px 12px 0;
  border-radius: var(--radius);
  border: 1px solid color-mix(in oklab, var(--border) 50%, transparent);
  background: color-mix(in oklab, var(--muted) 40%, transparent);
  font-size: 14px; line-height: 20px; color: var(--fg);
  outline: 0; transition: background-color .15s, border-color .15s, box-shadow .15s;
  appearance: none; -webkit-appearance: none;
}
.crm-input:hover { border-color: var(--border); background: color-mix(in oklab, var(--muted) 60%, transparent); }
.crm-input:focus { background: var(--card); border-color: color-mix(in oklab, var(--primary) 50%, transparent); box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 10%, transparent); }
.crm-input:focus-visible { outline: 0; }
select.crm-input { padding-right: 34px; cursor: pointer; }
.crm-ff .chev { position: absolute; right: 12px; top: 50%; margin-top: -8px; color: var(--mfg); opacity: .8; pointer-events: none; }
.crm-input.flash { animation: crm-flash 1.4s var(--ease); }
@keyframes crm-flash { 0%, 30% { background: color-mix(in oklab, var(--amber-500) 16%, var(--card)); border-color: color-mix(in oklab, var(--amber-500) 55%, transparent); } }

/* Kontakt-Referenz */
.crm-ref { margin: 16px 16px 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.crm-ref-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: color-mix(in oklab, var(--muted) 45%, var(--card)); border-bottom: 1px solid var(--border); }
.crm-avatar { flex: none; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #8b5cf6, #6366f1); color: #fff; font-size: 10px; font-weight: 600; }
.crm-ref-name { flex: 1; min-width: 0; }
.crm-ref-name small { display: block; font-size: 11px; line-height: 14px; color: var(--mfg); }
.crm-ref-name span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.crm-ref-name em { font-style: normal; font-weight: 400; color: var(--mfg); }
.crm-ref-tools { display: flex; gap: 2px; }
.crm-ref-tools .crm-ib { width: 30px; height: 30px; }
.crm-ref-body { padding: 12px 14px 14px; }
.crm-ref-kicker { display: flex; align-items: center; gap: 8px; padding-bottom: 10px; margin-bottom: 12px; border-bottom: 1px solid var(--border); font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--mfg); }
.crm-ref-kicker svg { color: var(--indigo-500); }
.crm-ref-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; margin: 0; }
.crm-ref-grid dt { display: flex; align-items: center; gap: 6px; font-size: 10px; line-height: 14px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--mfg); }
.crm-ref-grid dt svg { opacity: .7; }
.crm-ref-grid dd { margin: 4px 0 0 18px; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-ref.flash { animation: crm-ref-flash 1.6s var(--ease); }
@keyframes crm-ref-flash { 0%, 30% { box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 18%, transparent); border-color: color-mix(in oklab, var(--primary) 45%, transparent); } }
button.crm-ref-name { display: block; text-align: left; padding: 2px 6px; margin: -2px -6px; border-radius: 6px; transition: background-color .15s; }
button.crm-ref-name:hover, button.crm-ref-name[aria-expanded="true"] { background: color-mix(in oklab, var(--muted) 70%, transparent); }
button.crm-ref-name:hover span { color: var(--indigo-600); }

/* Leeres Referenzfeld „Auswählen oder anlegen…“ */
.crm-ref-empty {
  display: flex; align-items: center; gap: 10px; width: calc(100% - 32px); height: 48px; margin: 16px 16px 0; padding: 0 12px;
  border-radius: var(--radius); border: 1px solid color-mix(in oklab, var(--border) 50%, transparent);
  background: color-mix(in oklab, var(--muted) 40%, transparent);
  transition: background-color .15s, border-color .15s;
}
.crm-ref-empty:hover, .crm-ref-empty[aria-expanded="true"] { border-color: var(--border); background: color-mix(in oklab, var(--muted) 60%, transparent); }
.crm-ref-empty-ico { width: 28px; height: 28px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--muted); color: var(--mfg); transition: background-color .15s, color .15s; }
.crm-ref-empty:hover .crm-ref-empty-ico { background: var(--indigo-100); color: var(--indigo-600); }
.crm-ref-empty-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; line-height: 1; }
.crm-ref-empty-text small { font-size: 11px; font-weight: 500; color: var(--mfg); }
.crm-ref-empty-text span { font-size: 14px; line-height: 18px; color: color-mix(in oklab, var(--mfg) 75%, transparent); transition: color .15s; }
.crm-ref-empty:hover .crm-ref-empty-text span { color: var(--indigo-600); }
.crm-ref-chev { opacity: .4; }

/* Kontaktsuche (Command-Popover im CRM) */
.crm-picker { margin: 6px 16px 0; border: 1px solid var(--border); border-radius: 8px; background: var(--card); box-shadow: 0 1px 2px rgb(0 0 0 / .05), 0 12px 24px -14px rgb(0 0 0 / .2); overflow: hidden; animation: crm-pop-in .16s var(--ease); }
.crm-ref .crm-picker { margin: 0; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; box-shadow: none; animation: none; }
.crm-picker-search { display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 1px solid var(--border); color: var(--mfg); }
.crm-picker-search input { flex: 1; min-width: 0; height: 40px; border: 0; outline: 0; background: transparent; font-size: 14px; color: var(--fg); }
.crm-picker-list { max-height: 232px; overflow-y: auto; padding: 4px; }
.crm-picker-create { display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 10px; margin-bottom: 4px; border-radius: 6px; font-size: 14px; font-weight: 500; color: var(--indigo-600); box-shadow: 0 1px 0 color-mix(in oklab, var(--border) 60%, transparent); transition: background-color .15s; }
.crm-picker-create:hover, .crm-picker-create:focus-visible { background: var(--indigo-50); outline: none; }
.crm-picker-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border-radius: 8px; transition: background-color .15s; }
.crm-picker-item:hover, .crm-picker-item:focus-visible { background: color-mix(in srgb, var(--indigo-50) 80%, transparent); outline: none; }
.crm-picker-av { width: 32px; height: 32px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--indigo-100); color: #4338ca; font-size: 12px; font-weight: 700; }
.crm-picker-txt { flex: 1; min-width: 0; }
.crm-picker-txt b { display: block; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-picker-txt small { display: block; font-size: 12px; color: var(--mfg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crm-picker-item.on b { color: var(--primary); font-weight: 600; }
.crm-picker-ok { color: var(--primary); }
.crm-picker-empty { padding: 20px 8px; text-align: center; font-size: 14px; color: var(--mfg); }
.crm-form-error { font-size: 13px; color: var(--destructive); }
.crm-form-error[hidden] { display: none; }
.crm-input[aria-invalid="true"] { border-color: color-mix(in oklab, var(--destructive) 55%, transparent); }

/* ── Widget-Karten ──────────────────────────────────────── */
.crm-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); padding: 12px; }
.crm-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 16px; }
.crm-card-head h4 { display: flex; align-items: center; gap: 8px; font-size: 16px; line-height: 24px; font-weight: 600; }
.crm-card-head h4 svg { color: var(--primary); }
.crm-count { font-size: 12px; line-height: 16px; font-weight: 400; color: var(--mfg); background: var(--secondary); padding: 2px 8px; border-radius: 999px; }
.crm-card-tools { display: flex; align-items: center; gap: 4px; }
.crm-textbtn { height: 28px; padding: 0 8px; border-radius: 6px; font-size: 10px; color: var(--mfg); transition: color .15s, background-color .15s; }
.crm-textbtn:hover { color: var(--primary); background: var(--muted); }
.crm-plus { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; transition: background-color .2s, color .2s; }
.crm-plus:hover { background: var(--primary); color: #fff; }

/* Aufgaben */
.crm-tasks { display: flex; flex-direction: column; gap: 8px; }
.crm-task { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 8px; border: 1px solid transparent; transition: background-color .15s, border-color .15s, opacity .3s; }
.crm-task:hover { background: color-mix(in oklab, var(--muted) 50%, transparent); border-color: var(--border); }
.crm-task-check { color: var(--mfg); transition: color .15s; }
.crm-task-check:hover { color: var(--primary); }
.crm-task-main { flex: 1; min-width: 0; }
.crm-task-title { font-size: 14px; line-height: 1.25; font-weight: 500; }
.crm-task-meta { display: flex; align-items: center; gap: 12px; margin-top: 4px; font-size: 10px; line-height: 14px; color: var(--mfg); }
.crm-task-meta span { display: inline-flex; align-items: center; gap: 4px; }
.crm-task-meta .late { color: var(--destructive); font-weight: 600; }
.crm-task-end { display: flex; align-items: center; gap: 8px; }
.crm-task-end .alert { color: var(--destructive); animation: crm-pulse 2s cubic-bezier(.4, 0, .6, 1) infinite; }
.crm-rm { width: 28px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: var(--mfg); opacity: 0; transition: opacity .15s, color .15s, background-color .15s; }
.crm-task:hover .crm-rm, .crm-note:hover .crm-rm, .crm-rm:focus-visible { opacity: 1; }
.crm-rm:hover { color: var(--destructive); background: var(--muted); }
.crm-done-label { padding: 8px 8px 0; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--mfg); }
.crm-task.is-done { opacity: .6; filter: grayscale(.5); }
.crm-task.is-done .crm-task-check { color: var(--primary); }
.crm-task.is-done .crm-task-title { font-weight: 400; text-decoration: line-through; color: var(--mfg); }
.crm-task.enter { animation: crm-enter .45s var(--ease); }
@keyframes crm-enter { from { opacity: 0; transform: translateY(-6px); background: color-mix(in oklab, var(--primary) 8%, transparent); } }
.crm-empty { padding: 2px 4px; font-size: 12px; font-style: italic; color: color-mix(in oklab, var(--mfg) 60%, transparent); }

/* Notizen & Aktivitäten */
.crm-filters { display: flex; gap: 4px; padding: 0 8px 4px; margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.crm-filters::-webkit-scrollbar { display: none; }
.crm-chip { flex: none; display: inline-flex; align-items: center; height: 28px; padding: 0 10px; border-radius: 999px; font-size: 12px; color: var(--mfg); transition: background-color .15s, color .15s; }
.crm-chip:hover { background: var(--muted); }
.crm-chip[aria-pressed="true"] { background: color-mix(in oklab, var(--primary) 10%, transparent); color: var(--primary); font-weight: 500; gap: 4px; }
.crm-notes { display: flex; flex-direction: column; margin-bottom: 16px; }
.crm-note { position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 8px; border-radius: 8px; border: 1px solid transparent; transition: background-color .15s, border-color .15s; }
.crm-note:hover { background: color-mix(in oklab, var(--muted) 50%, transparent); border-color: var(--border); }
.crm-note + .crm-note { margin-top: 9px; }
.crm-note + .crm-note::before { content: ""; position: absolute; left: 0; right: 0; top: -6px; height: 1px; background: var(--border); opacity: .5; }
.crm-note.enter { animation: crm-enter .5s var(--ease); }
.crm-note-main { flex: 1; min-width: 0; }
.crm-note-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.crm-note-top strong { font-size: 14px; font-weight: 600; }
.crm-note-top time { margin-left: auto; font-size: 10px; color: var(--mfg); white-space: nowrap; }
.crm-note .crm-rm { position: absolute; top: 4px; right: 4px; background: var(--card); }
.crm-note-body { display: flex; align-items: flex-start; gap: 10px; }
.crm-note-ico { flex: none; margin-top: 2px; padding: 6px; border-radius: 6px; background: color-mix(in oklab, var(--primary) 10%, transparent); color: var(--primary); }
.crm-note-ico.call { background: color-mix(in srgb, var(--green-100) 80%, transparent); color: var(--green-600); }
.crm-note-ico.meeting { background: color-mix(in srgb, var(--purple-100) 80%, transparent); color: var(--purple-600); }
.crm-note-ico.auto { background: var(--amber-100); color: var(--amber-600); }
.crm-note-text { font-size: 14px; line-height: 1.625; color: color-mix(in oklab, var(--fg) 90%, transparent); white-space: pre-wrap; overflow-wrap: anywhere; }
.crm-note-when { font-size: 12px; font-weight: 600; color: var(--primary); margin-bottom: 4px; }
.crm-time { flex: 1; padding: 12px; border-radius: 10px; background: color-mix(in srgb, #fffbeb 50%, var(--card)); border: 1px solid #fef3c7; }
.crm-time-head { display: flex; align-items: center; gap: 8px; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid color-mix(in srgb, #fef3c7 50%, transparent); }
.crm-time-head > span:first-child { padding: 6px; border-radius: 8px; background: var(--amber-500); color: #fff; }
.crm-time-head p { font-size: 10px; line-height: 1; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--amber-700); }
.crm-time-head b { display: inline-block; margin-top: 3px; padding: 1px 6px; border-radius: 4px; background: #fde68a; color: #78350f; font-size: 12px; }
.crm-mail { flex: 1; min-width: 0; padding: 10px; border-radius: 10px; border: 1px solid var(--border); background: color-mix(in oklab, var(--card) 50%, transparent); box-shadow: 0 1px 2px rgb(0 0 0 / .05); font-size: 14px; }
.crm-mail-head { display: flex; align-items: center; gap: 8px; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid color-mix(in oklab, var(--border) 50%, transparent); }
.crm-mail-head > span:first-child { padding: 6px; border-radius: 4px; background: var(--blue-100); color: var(--blue-600); }
.crm-mail-head p { flex: 1; min-width: 0; font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
.crm-demo-pill { flex: none; padding: 2px 6px; border-radius: 999px; background: var(--amber-100); color: var(--amber-700); font-size: 10px; font-weight: 600; }
.crm-mail-meta { margin-bottom: 10px; padding: 8px; border-radius: 4px; border: 1px solid color-mix(in oklab, var(--border) 50%, transparent); background: color-mix(in oklab, var(--muted) 10%, transparent); font-size: 11px; display: flex; flex-direction: column; gap: 4px; }
.crm-mail-meta div { display: flex; gap: 8px; min-width: 0; }
.crm-mail-meta span:first-child { width: 36px; flex: none; font-size: 10px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--mfg); }
.crm-mail-meta span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-mail-body { padding: 8px; border-radius: 4px; background: color-mix(in oklab, var(--muted) 30%, transparent); font-size: 12px; line-height: 1.55; white-space: pre-wrap; }

/* Eingabe unten im Notizen-Widget */
.crm-composer { position: relative; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--card); box-shadow: 0 1px 2px rgb(0 0 0 / .05); transition: border-color .15s, box-shadow .15s; }
.crm-composer:focus-within { border-color: color-mix(in oklab, var(--primary) 50%, transparent); box-shadow: 0 0 0 1px color-mix(in oklab, var(--primary) 30%, transparent); }
.crm-types { display: flex; gap: 4px; padding: 4px; background: color-mix(in oklab, var(--muted) 30%, var(--card)); border-bottom: 1px solid color-mix(in oklab, var(--border) 50%, transparent); overflow-x: auto; scrollbar-width: none; }
.crm-types::-webkit-scrollbar { display: none; }
.crm-type { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 8px; font-size: 12px; font-weight: 500; transition: background-color .15s; }
.crm-type:hover { background: var(--muted); }
.crm-type[aria-pressed="true"] { background: var(--secondary); box-shadow: 0 1px 2px rgb(0 0 0 / .05); }
.crm-type[aria-pressed="true"]:hover { background: color-mix(in oklab, var(--secondary) 80%, var(--border)); }
.crm-compose { position: relative; padding: 12px; }
.crm-minutes { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--primary); }
.crm-minutes input { width: 72px; height: 30px; border: 1px solid color-mix(in oklab, var(--primary) 30%, transparent); border-radius: 8px; text-align: center; font-size: 12px; font-weight: 700; outline: 0; background: var(--card); }
.crm-minutes[hidden] { display: none; }
.crm-textarea { display: block; width: 100%; min-height: 28px; max-height: 160px; padding: 4px 116px 4px 0; border: 0; outline: 0; resize: none; background: transparent; font-size: 14px; line-height: 20px; transition: min-height .3s var(--ease), padding .3s var(--ease); }
.crm-textarea::placeholder { color: color-mix(in oklab, var(--mfg) 60%, transparent); }
.crm-textarea.open { min-height: 90px; padding-top: 8px; padding-bottom: 8px; }
.crm-textarea:focus-visible { outline: 0; }
.crm-compose-tools { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 4px; }
.crm-compose-tools .crm-ib { width: 32px; height: 32px; }
.crm-compose-tools .crm-ib:hover { color: var(--primary); background: color-mix(in oklab, var(--primary) 5%, transparent); }
.crm-send { width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .05); transition: opacity .15s, transform .1s; }
.crm-send:active { transform: scale(.95); }
.crm-send:disabled { opacity: .5; cursor: default; }

/* ── Dialoge ────────────────────────────────────────────── */
.crm-overlay { position: absolute; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgb(0 0 0 / .45); animation: crm-fade .2s ease; }
.crm-overlay[hidden] { display: none; }
@keyframes crm-fade { from { opacity: 0; } }
.crm-dialog { width: 100%; max-width: 460px; max-height: 100%; overflow-y: auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 25px 50px -12px rgb(0 0 0 / .25); animation: crm-zoom .2s var(--ease); }
@keyframes crm-zoom { from { opacity: 0; transform: scale(.96); } }
.crm-dialog-head { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.crm-dialog-head h3 { font-size: 16px; font-weight: 600; }
.crm-dialog-body { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.crm-dialog-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.crm-dialog-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.crm-alert { max-width: 480px; padding: 24px; }
.crm-alert h3 { display: flex; align-items: center; gap: 8px; font-size: 18px; line-height: 1.3; font-weight: 600; }
.crm-alert h3 svg { color: var(--indigo-500); }
.crm-alert p { margin-top: 8px; font-size: 14px; color: var(--mfg); }
.crm-alert .crm-dialog-foot { margin-top: 20px; flex-wrap: wrap; }
.crm-alert .crm-dialog-foot .crm-btn.ghost { margin-right: auto; color: var(--mfg); }

/* ── Toasts (sonner) ────────────────────────────────────── */
.crm-toasts { position: absolute; right: 14px; bottom: 14px; z-index: 50; width: 340px; max-width: calc(100% - 28px); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.crm-toast { pointer-events: auto; display: flex; gap: 10px; padding: 12px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); box-shadow: 0 4px 12px rgb(0 0 0 / .1); font-size: 13px; line-height: 18px; animation: crm-toast-in .35s var(--ease); }
.crm-toast.out { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
@keyframes crm-toast-in { from { opacity: 0; transform: translateY(12px); } }
.crm-toast > svg { margin-top: 1px; }
.crm-toast.ok > svg { color: var(--green-600); }
.crm-toast.info > svg { color: var(--mfg); }
.crm-toast.auto > svg { color: var(--amber-500); }
.crm-toast b { display: block; font-weight: 600; }
.crm-toast small { display: block; margin-top: 2px; font-size: 12px; color: var(--mfg); }
.crm-steps { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.crm-steps li { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--mfg); opacity: .45; transition: opacity .25s, color .25s; }
.crm-steps li.run, .crm-steps li.ok { opacity: 1; color: var(--fg); }
.crm-steps li > span { width: 14px; height: 14px; display: inline-flex; align-items: center; justify-content: center; }
.crm-steps li .spin { animation: crm-spin .8s linear infinite; }
.crm-steps li.ok > span { color: var(--green-600); }
@keyframes crm-spin { to { transform: rotate(360deg); } }

/* ── Schmale Breite: Spalten werden zu Tabs wie in der mobilen CRM-Ansicht ── */
@container (max-width: 760px) {
  .crm { height: auto; min-height: 560px; }
  .crm-tabs { display: flex; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
  .crm-tab { flex: none; height: 32px; padding: 0 12px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--mfg); }
  .crm-tab[aria-selected="true"] { background: var(--secondary); color: var(--fg); }
  .crm-body { display: block; margin-top: 0; }
  .crm-main, .crm-side { width: auto; overflow: visible; border: 0; padding: 14px 12px 16px; }
  .crm-sec-title { display: none; }
  .crm-fields, .crm-ref, .crm-picker { margin-inline: 0; padding-inline: 0; }
  .crm-ref-empty { margin-inline: 0; width: 100%; }
  .crm[data-tab="info"] .crm-side,
  .crm[data-tab="tasks"] .crm-main, .crm[data-tab="tasks"] .crm-card.notes,
  .crm[data-tab="notes"] .crm-main, .crm[data-tab="notes"] .crm-card.tasks { display: none; }
  .crm-hide-sm { display: none; }
  .crm-head { padding: 10px 12px 6px; }
  .crm-title { font-size: 16px; }
  .crm-bpf { padding-inline: 0; }
}
@container (max-width: 520px) {
  .crm-fields, .crm-ref-grid, .crm-dialog-row { grid-template-columns: minmax(0, 1fr); }
  .crm-hide-xs { display: none; }
  .crm-desc { display: none; }
  .crm-hist { right: -44px; width: 290px; }
  .crm-term-pop { left: auto; right: -6px; transform: none; animation: crm-pop-in .16s var(--ease); }
}

@media (prefers-reduced-motion: reduce) {
  .crm *, .crm *::before, .crm *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Platz reservieren, bis das Skript die Vorschau aufgebaut hat (kein Springen beim Laden) */
/* Der Host ist der Container, nach dem sich die Vorschau richtet */
.crm-host { container-type: inline-size; min-height: 640px; background: #fff; }
@media (max-width: 830px) { .crm-host { min-height: 560px; } }

/* =========================================================
   Lead-Liste mit Kanban (Kapitel „Leads & Pipeline“)
   Vorlage: universal-entity-client-view (Titelleiste),
   dynamic-entity-list (dense + flush), kanban-board.
   ========================================================= */
.crm-host-leads { min-height: 560px; }
.crm.crm-leads { flex-direction: row; height: 560px; }
.crl-rail { flex: none; width: 56px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 0; border-right: 1px solid var(--border); color: var(--mfg); }
.crl-rail > span { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border-radius: 10px; }
.crl-rail > .on { background: linear-gradient(135deg, var(--indigo-500), #8b5cf6); color: #fff; box-shadow: 0 4px 10px -3px rgb(99 102 241 / .5); }
.crl-rail > .grow { flex: 1; }
.crl-rail > .me { border-radius: 50%; background: var(--secondary); }
.crl-app { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* Titelleiste */
.crl-top { flex: none; height: 52px; display: flex; align-items: center; gap: 6px; padding: 0 10px 0 12px; border-bottom: 1px solid var(--border); }
.crl-top-left { flex: 1 1 auto; display: flex; align-items: center; gap: 6px; min-width: 0; }
.crm-leads.has-sel .crl-hide-sel { display: none !important; }
.crl-top-right { margin-left: auto; display: flex; align-items: center; gap: 4px; flex: none; }
.crl-views { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 8px; background: var(--secondary); font-size: 13px; font-weight: 500; white-space: nowrap; transition: background-color .15s; }
.crl-views:hover, .crl-views[aria-expanded="true"] { background: color-mix(in oklab, var(--secondary) 60%, var(--border)); }
.crl-views svg { color: var(--mfg); }
.crl-views span { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.crl-sep { width: 1px; height: 16px; margin: 0 4px; background: var(--border); flex: none; }
.crl-vt { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 8px; border-radius: 8px; font-size: 12px; transition: background-color .15s; }
.crl-vt:hover { background: var(--muted); }
.crl-vt[aria-pressed="true"] { background: var(--secondary); font-weight: 500; }
.crl-vt .lb { display: none; }
.crl-vt[aria-pressed="true"] .lb { display: inline; }
.crl-create { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 16px; margin-left: 2px; border-radius: 10px; background: linear-gradient(90deg, #4f46e5, #9333ea); color: #fff; font-size: 14px; font-weight: 500; box-shadow: 0 4px 6px -1px rgb(165 180 252 / .25); transition: filter .2s, transform .1s; }
.crl-create:hover { filter: brightness(.92); }
.crl-create:active { transform: scale(.98); }
.crl-search { position: relative; margin-left: 6px; }
.crl-search svg { position: absolute; left: 10px; top: 50%; margin-top: -7px; color: var(--mfg); pointer-events: none; }
.crl-search input { width: 190px; height: 34px; padding: 0 10px 0 32px; border-radius: 8px; border: 1px solid transparent; background: color-mix(in oklab, var(--muted) 70%, var(--card)); font-size: 13px; outline: 0; transition: background-color .15s, border-color .15s, box-shadow .15s; }
.crl-search input::placeholder { color: var(--mfg); }
.crl-search input:focus { background: var(--card); border-color: color-mix(in oklab, var(--primary) 50%, transparent); box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 10%, transparent); }
.crl-bulk { display: flex; align-items: center; gap: 4px; padding-left: 8px; margin-left: 2px; border-left: 1px solid var(--border); animation: crm-pop-in .16s var(--ease); }
.crl-bulk[hidden] { display: none; }
.crl-bulk b { margin-right: 2px; padding: 3px 8px; border-radius: 999px; background: var(--indigo-50); color: var(--indigo-600); font-size: 12px; font-weight: 600; white-space: nowrap; }
.crl-bulk .crm-btn { height: 30px; padding: 0 10px; font-size: 12px; }
.crl-bulk .crm-btn.danger { color: var(--destructive); }
.crl-bulk .crm-btn.danger:hover { background: color-mix(in oklab, var(--destructive) 10%, transparent); }

.crl-view { flex: 1; min-height: 0; position: relative; }

/* Liste */
.crl-list { height: 100%; overflow: auto; }
.crl-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
.crl-table th { position: sticky; top: 0; z-index: 2; background: var(--card); padding: 6px 12px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; color: color-mix(in oklab, var(--mfg) 85%, transparent); }
.crl-th { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.crl-sort { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; transition: color .15s; }
.crl-sort:hover { color: var(--fg); }
.crl-funnel { width: 24px; height: 24px; flex: none; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .15s, background-color .15s; }
.crl-table th:hover .crl-funnel, .crl-funnel:focus-visible, .crl-funnel[aria-expanded="true"] { opacity: 1; }
.crl-funnel:hover { background: #e4e4e7; }
.crl-funnel.on { opacity: 1; color: var(--indigo-600); background: var(--indigo-50); }
.crl-th-check, .crl-td-check { width: 44px; padding: 6px 8px !important; text-align: center !important; }
.crl-th-add { width: 40px; padding: 6px 8px !important; text-align: center !important; }
.crl-add { width: 24px; height: 24px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; color: var(--mfg); transition: background-color .15s, color .15s; }
.crl-add:hover, .crl-add[aria-expanded="true"] { background: #f4f4f5; color: var(--fg); }
.crl-table td { padding: 6px 12px; border-bottom: 1px solid #f4f4f5; border-right: 1px solid #f4f4f5; color: #52525b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px; }
.crl-table td:last-child { border-right: 0; }
.crl-table td.id { font-weight: 600; color: #18181b; }
.crl-row { cursor: pointer; transition: background-color .15s; }
.crl-row:hover { background: #fafafa; }
.crl-row.sel { background: color-mix(in srgb, var(--indigo-50) 45%, transparent); }
.crl-row.enter { animation: crl-flash 1.8s var(--ease); }
@keyframes crl-flash { 0%, 35% { background: color-mix(in srgb, var(--indigo-50) 95%, transparent); } }
.crl-group td { padding: 8px 12px; background: color-mix(in srgb, #fafafa 40%, var(--card)); border-right: 0; }
.crl-group-in { display: flex; align-items: center; gap: 8px; }
.crl-gbadge { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px; font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.crl-gbadge.plain { background: var(--card); border: 1px solid #e4e4e7; color: var(--fg); }
.crl-gcount { font-size: 11px; font-weight: 500; color: color-mix(in oklab, var(--mfg) 65%, transparent); }
.crl-status { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 6px; font-size: 11px; font-weight: 500; white-space: nowrap; transition: filter .15s, box-shadow .15s; }
.crl-status:hover, .crl-status[aria-expanded="true"] { filter: brightness(.95); box-shadow: 0 0 0 2px color-mix(in oklab, var(--primary) 18%, transparent); }
.crl-user { display: inline-flex; align-items: center; gap: 6px; }
.crl-user svg { color: var(--mfg); }
.crl-check { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid #d4d4d8; display: inline-flex; align-items: center; justify-content: center; color: #fff; background: var(--card); transition: background-color .15s, border-color .15s; vertical-align: middle; }
.crl-check:hover { border-color: var(--indigo-500); }
.crl-check svg { opacity: 0; transform: scale(.6); transition: opacity .15s, transform .2s var(--ease); }
.crl-check[aria-checked="true"], .crl-check[aria-checked="mixed"] { background: var(--indigo-600); border-color: var(--indigo-600); }
.crl-check[aria-checked="true"] svg, .crl-check[aria-checked="mixed"] svg { opacity: 1; transform: none; }
.crl-empty-row td { padding: 28px 12px; text-align: center; font-style: italic; color: var(--mfg); }

/* Kanban */
.crl-board { height: 100%; display: flex; gap: 12px; overflow-x: auto; padding: 12px; scroll-snap-type: x proximity; }
.crl-col { flex: 0 0 256px; min-height: 0; display: flex; flex-direction: column; gap: 4px; padding: 6px; border-radius: 10px; background: color-mix(in srgb, #fafafa 75%, transparent); scroll-snap-align: start; }
.crl-col-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px; }
.crl-col-head > span:first-child { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12px; font-weight: 600; color: color-mix(in oklab, var(--fg) 80%, transparent); }
.crl-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; }
.crl-col-count { font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; color: color-mix(in oklab, var(--mfg) 70%, transparent); }
.crl-drop { flex: 1; min-height: 120px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 2px; border-radius: 8px; transition: background-color .2s, box-shadow .2s; }
.crl-col.over .crl-drop { background: color-mix(in srgb, var(--indigo-50) 75%, transparent); box-shadow: inset 0 0 0 1px #c7d2fe; }
.crl-col-empty { height: 80px; display: flex; align-items: center; justify-content: center; font-size: 11px; color: color-mix(in oklab, var(--mfg) 45%, transparent); }
.crl-card { flex: none; border: 1px solid #e4e4e7; border-radius: 10px; background: var(--card); cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; transition: border-color .15s, box-shadow .15s, opacity .15s; }
.crl-card:hover { border-color: #d4d4d8; box-shadow: 0 1px 2px rgb(0 0 0 / .05); }
.crl-card.dragging { opacity: .35; }
.crl-card.enter { animation: crl-card-in .6s var(--ease); }
@keyframes crl-card-in { from { opacity: 0; transform: scale(.96); box-shadow: 0 0 0 2px #a5b4fc; } }
.crl-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 4px; padding: 8px 8px 6px; }
.crl-card-title { flex: 1; min-width: 0; font-size: 12px; font-weight: 600; line-height: 1.3; color: color-mix(in oklab, var(--fg) 90%, transparent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crl-smart { display: flex; gap: 2px; margin: -2px -2px 0 0; opacity: 0; transition: opacity .15s; }
.crl-card:hover .crl-smart, .crl-card:focus-within .crl-smart, .crl-smart.open { opacity: 1; }
.crl-smart button { width: 24px; height: 24px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; color: color-mix(in oklab, var(--mfg) 65%, transparent); transition: background-color .15s, color .15s; }
.crl-smart button:hover { background: #f4f4f5; color: var(--fg); }
.crl-card-body { padding: 0 8px 8px; }
.crl-fields { display: flex; flex-direction: column; gap: 6px; padding-top: 6px; border-top: 1px solid color-mix(in oklab, var(--border) 45%, transparent); }
.crl-fields > div { display: flex; align-items: center; justify-content: space-between; font-size: 11px; }
.crl-fields span:first-child { flex: none; margin-right: 8px; color: color-mix(in oklab, var(--mfg) 85%, transparent); }
.crl-fields span:last-child { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; color: color-mix(in oklab, var(--fg) 80%, transparent); }
@media (hover: none) { .crl-smart { opacity: 1; } }

/* Gezogene Karte folgt dem Zeiger (liegt direkt im body) */
.crm.crl-ghost { position: fixed; top: 0; left: 0; z-index: 1000; width: 240px; height: auto; overflow: visible; background: transparent; pointer-events: none; }
.crm.crl-ghost .crl-card { cursor: grabbing; box-shadow: 0 12px 24px -6px rgb(0 0 0 / .18), 0 0 0 1px #a5b4fc; }
.crm.crl-ghost .crl-smart { opacity: 0; }

/* Schwebende Popover (liegen im Wurzelelement, damit Scrollbereiche sie nicht abschneiden) */
.crl-float { position: absolute; z-index: 35; padding: 4px; }
.crl-float.w56 { width: 224px; }
.crl-float.w64 { width: 256px; }
.crl-float .crm-menu-item svg { color: var(--mfg); }
.crl-float .crm-menu-item.auto svg { color: var(--amber-500); }
.crl-float .crm-menu-item[aria-checked="true"] { font-weight: 500; }
.crl-float .crm-menu-item[aria-checked="true"] svg { color: var(--indigo-600); }
.crl-menu-sep { height: 1px; margin: 4px -4px; background: var(--border); }
.crl-fp { padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.crl-fp label { margin-left: 4px; font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: color-mix(in oklab, var(--mfg) 65%, transparent); }
.crl-fp input { width: 100%; height: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid #e4e4e7; background: color-mix(in srgb, #fafafa 60%, var(--card)); font-size: 12px; outline: 0; }
.crl-fp input:focus { border-color: color-mix(in oklab, var(--primary) 50%, transparent); box-shadow: 0 0 0 3px color-mix(in oklab, var(--primary) 10%, transparent); }
.crl-fp-group { display: flex; align-items: center; gap: 8px; width: 100%; height: 36px; padding: 0 10px; margin-top: 2px; border-radius: 8px; font-size: 12px; color: var(--mfg); border-top: 1px solid #f4f4f5; }
.crl-fp-group:hover { background: var(--muted); }
.crl-fp-group.on { color: var(--indigo-600); background: var(--indigo-50); font-weight: 600; }
.crl-note-pop { padding: 4px; }
.crl-note-pop textarea { display: block; width: 100%; min-height: 70px; margin-bottom: 8px; padding: 8px; border-radius: 8px; border: 1px solid var(--border); font-size: 12px; line-height: 1.5; resize: none; outline: 0; }
.crl-note-pop textarea:focus { border-color: color-mix(in oklab, var(--primary) 50%, transparent); }
.crl-note-pop div { display: flex; justify-content: flex-end; }
.crl-note-pop .crm-btn { height: 28px; padding: 0 12px; font-size: 12px; }

/* Schmalere Rahmen */
@container (max-width: 900px) {
  .crl-rail { display: none; }
  .crl-search input { width: 140px; }
  .crl-hide-lg { display: none !important; }
}
@container (max-width: 680px) {
  .crm.crm-leads { height: 520px; }
  .crl-hide-md { display: none !important; }
  .crl-create .lb { display: none; }
  .crl-create { padding: 0 10px; }
  .crl-col { flex-basis: 232px; }
  .crl-top { padding: 0 8px; }
}
@container (max-width: 480px) { .crl-views span { display: none; } }
@media (max-width: 760px) { .crm-host-leads { min-height: 520px; } }

/* Im Vollbild füllt die Vorschau das Fenster; schmal gestapelt scrollt der Host */
.frame-browser.is-expanded .crm-host { flex: 1; min-height: 0; overflow: auto; }
.frame-browser.is-expanded .crm { height: 100%; min-height: 0; }
@container (max-width: 760px) {
  .frame-browser.is-expanded .crm:not(.crm-leads) { height: auto; min-height: 100%; }
}

/* =========================================================
   Kalender (Kapitel „Kalender“)
   ========================================================= */
.crm.crm-cal, .crm.crm-quote, .crm.crm-dash, .crm.crm-plan { flex-direction: row; height: 560px; }
.crm-host-chapter { min-height: 560px; }
.cal-top { flex: none; height: 56px; display: flex; align-items: stretch; gap: 8px; padding: 0 10px 0 12px; border-bottom: 1px solid var(--border); }
.cal-top > * { align-self: center; }
.cal-nav { display: flex; align-items: center; gap: 4px; }
.cal-today { height: 32px; padding: 0 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; font-weight: 500; background: var(--card); }
.cal-today:hover { background: var(--muted); }
.cal-range { margin-left: 8px; font-size: 15px; font-weight: 700; white-space: nowrap; }
.cal-tabs { margin-left: auto; align-self: stretch !important; display: flex; }
.cal-tab { padding: 0 16px; font-size: 14px; color: var(--mfg); border-bottom: 2px solid transparent; transition: color .15s, border-color .15s; }
.cal-tab:hover { color: var(--fg); }
.cal-tab[aria-selected="true"] { color: var(--indigo-600); border-bottom-color: var(--indigo-600); font-weight: 500; }
.cal-people { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 6px; border: 1px solid #a5b4fc; color: var(--fg); font-size: 13px; font-weight: 500; white-space: nowrap; }
.cal-people:hover, .cal-people[aria-expanded="true"] { background: var(--indigo-50); }
.cal-vsep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.cal-body { flex: 1; min-height: 0; position: relative; }

/* Woche / Tag */
.cal-wk { height: 100%; display: flex; flex-direction: column; overflow-x: auto; }
.cal-inner { min-width: 640px; height: 100%; display: flex; flex-direction: column; }
.cal-head { flex: none; display: grid; border-bottom: 1px solid var(--border); }
.cal-dh { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 0 12px; border-left: 1px solid #f4f4f5; }
.cal-dh small { font-size: 11px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--mfg); }
.cal-dh b { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 15px; font-weight: 600; }
.cal-dh b.today { background: #2563eb; color: #fff; }
.cal-dh.person { flex-direction: row; justify-content: center; gap: 8px; padding: 12px 6px; font-size: 13px; font-weight: 600; }
.cal-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; position: relative; }
.cal-grid { position: relative; display: grid; }
.cal-times { position: relative; }
.cal-times span { position: absolute; right: 8px; font-size: 11px; color: var(--mfg); transform: translateY(-50%); }
.cal-col { position: relative; border-left: 1px solid #f4f4f5; cursor: cell; background-image: linear-gradient(to bottom, #f4f4f5 1px, transparent 1px); background-size: 100% var(--h); }
.cal-col.today { background-color: color-mix(in srgb, #f8fafc 70%, transparent); }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: #ef4444; z-index: 3; pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: #ef4444; }
.cal-ev {
  --c: #3b82f6;
  position: absolute; z-index: 2; overflow: hidden; display: flex; gap: 6px; align-items: flex-start;
  padding: 6px 6px 4px 8px; border-radius: 4px; border-left: 3px solid var(--c);
  background: color-mix(in srgb, var(--c) 9%, #fff); color: color-mix(in srgb, var(--c) 70%, #000);
  cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: box-shadow .15s, opacity .15s;
}
.cal-ev:hover { box-shadow: 0 1px 3px rgb(0 0 0 / .12); z-index: 4; }
.cal-ev:focus-visible { outline: 2px solid var(--c); outline-offset: 1px; }
.cal-ev.dragging { opacity: .35; }
.cal-ev.enter { animation: crl-card-in .5s var(--ease); }
.cal-ev.ghost { opacity: .92; box-shadow: 0 10px 24px -8px rgb(0 0 0 / .25); z-index: 6; pointer-events: none; cursor: grabbing; }
.cal-av { flex: none; width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--c); color: #fff; font-size: 8px; font-weight: 700; }
.cal-ev-txt { min-width: 0; }
.cal-ev-txt b { display: block; font-size: 12px; line-height: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev-txt small { display: block; font-size: 11px; line-height: 15px; color: var(--mfg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-busy { position: absolute; z-index: 1; border-radius: 4px; padding: 4px 6px; font-size: 10px; font-weight: 500; color: var(--mfg); pointer-events: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  background: repeating-linear-gradient(135deg, #f4f4f5 0 6px, #e9e9ec 6px 12px); border: 1px dashed #d4d4d8; }

/* Monat */
.cal-month { height: 100%; display: flex; flex-direction: column; }
.cal-mhead { flex: none; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--border); }
.cal-mhead span { padding: 8px 0; text-align: center; font-size: 11px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--mfg); }
.cal-mgrid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); }
.cal-mday { min-width: 0; padding: 4px; border-right: 1px solid #f4f4f5; border-bottom: 1px solid #f4f4f5; overflow: hidden; text-align: left; display: flex; flex-direction: column; gap: 2px; transition: background-color .15s; }
.cal-mday:hover { background: #fafafa; }
.cal-mday.out { background: color-mix(in srgb, #fafafa 60%, transparent); color: var(--mfg); }
.cal-mday > b { align-self: flex-start; min-width: 22px; height: 22px; padding: 0 4px; display: flex; align-items: center; justify-content: center; border-radius: 999px; font-size: 12px; font-weight: 600; }
.cal-mday > b.today { background: #2563eb; color: #fff; }
.cal-chip { --c: #3b82f6; display: flex; align-items: center; gap: 4px; min-width: 0; padding: 1px 4px; border-radius: 4px; font-size: 11px; line-height: 16px; background: color-mix(in srgb, var(--c) 9%, #fff); color: color-mix(in srgb, var(--c) 70%, #000); }
.cal-chip i { width: 6px; height: 6px; flex: none; border-radius: 50%; background: var(--c); }
.cal-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-more { font-size: 11px; color: var(--mfg); padding-left: 4px; }

/* Popover-Inhalte */
.cal-pp { padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.cal-pp-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; border-radius: 6px; font-size: 13px; }
.cal-pp-row:hover { background: var(--muted); }
.cal-pp-row .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.cal-pp-row .box { width: 16px; height: 16px; flex: none; margin-left: auto; border-radius: 4px; border: 1.5px solid #d4d4d8; display: flex; align-items: center; justify-content: center; color: #fff; }
.cal-pp-row[aria-checked="true"] .box { background: var(--indigo-600); border-color: var(--indigo-600); }
.cal-pp-row .box svg { opacity: 0; }
.cal-pp-row[aria-checked="true"] .box svg { opacity: 1; }
.cal-evpop { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.cal-evpop h4 { display: flex; align-items: flex-start; gap: 8px; font-size: 15px; line-height: 1.3; }
.cal-evpop h4 i { width: 10px; height: 10px; margin-top: 5px; flex: none; border-radius: 3px; }
.cal-evpop dl { margin: 0; display: grid; grid-template-columns: 18px 1fr; gap: 6px 8px; font-size: 13px; color: var(--mfg); }
.cal-evpop dd { margin: 0; color: var(--fg); }
.cal-evpop .row { display: flex; justify-content: flex-end; gap: 6px; }
.cal-evpop .crm-btn { height: 30px; padding: 0 10px; font-size: 12px; }
.cal-evpop .crm-btn.danger { color: var(--destructive); }

@container (max-width: 900px) { .cal-tab { padding: 0 10px; } }
@container (max-width: 680px) {
  .cal-range { font-size: 13px; }
  .cal-people .lb { display: none; }
  .cal-top { gap: 4px; padding: 0 8px; }
}
@container (max-width: 520px) { .cal-range { display: none; } }

/* =========================================================
   Angebot / Rechnung (Kapitel „Angebote & Rechnungen“)
   ========================================================= */
.crm.crm-quote { flex-direction: column; }
.crm-quote .crm-head { padding-bottom: 6px; }
.qt-send { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #7c3aed; color: #fff; box-shadow: 0 2px 6px -1px rgb(124 58 237 / .45); transition: background-color .15s, transform .1s; }
.qt-send:hover { background: #6d28d9; }
.qt-send:active { transform: scale(.96); }
.qt-tabs { display: none; }
.qt-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); margin-top: 8px; }
.qt-left { overflow-y: auto; padding: 4px 16px 20px 20px; border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 14px; }
.qt-right { overflow-y: auto; padding: 4px 16px 20px; display: flex; flex-direction: column; gap: 10px; }
.qt-sec { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 34px; padding-bottom: 8px; border-bottom: 1px solid var(--border); font-size: 16px; font-weight: 600; }
.qt-contact { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: color-mix(in oklab, var(--muted) 45%, var(--card)); }
.qt-contact div { min-width: 0; }
.qt-contact small { display: block; font-size: 11px; color: var(--mfg); }
.qt-contact div span { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qt-contact em { font-style: normal; font-weight: 400; color: var(--mfg); }
.qt-from { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 8px; background: var(--indigo-50); color: var(--indigo-600); font-size: 13px; }
.qt-bulk { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 400; }
.qt-bulk b { padding: 2px 8px; border-radius: 999px; background: var(--indigo-50); color: var(--indigo-600); font-weight: 600; }
.qt-bulk .crm-btn { height: 28px; padding: 0 8px; font-size: 12px; color: var(--destructive); }
.qt-grid { border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); overflow: hidden; }
.qt-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 14px; }
.qt-table th { padding: 10px 12px; background: color-mix(in oklab, var(--muted) 40%, var(--card)); border-bottom: 1px solid var(--border); border-right: 1px solid color-mix(in oklab, var(--border) 70%, transparent); text-align: left; font-size: 13px; font-weight: 400; color: var(--mfg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qt-table th.r { text-align: right; }
.qt-table th .req { color: var(--destructive); }
.qt-table td { height: 40px; padding: 0; border-bottom: 1px solid var(--border); border-right: 1px solid color-mix(in oklab, var(--border) 70%, transparent); }
.qt-table th:last-child, .qt-table td:last-child { border-right: 0; }
.qt-table col.c-check, .qt-table col.c-tool { width: 40px; }
.qt-table col.c-nr { width: 42px; }
.qt-table col.c-qty { width: 96px; }
.qt-table col.c-price { width: 96px; }
.qt-table col.c-amount { width: 116px; }
.qt-c { text-align: center; }
.qt-table th.qt-c { padding: 0; overflow: visible; }
.qt-nr { text-align: center; font-size: 13px; color: var(--mfg); }
.qt-in { width: 100%; height: 40px; padding: 0 12px; border: 0; background: transparent; font-size: 14px; outline: 0; text-overflow: ellipsis; }
.qt-in:focus-visible, .qt-in:focus { box-shadow: inset 0 0 0 1px #818cf8; background: color-mix(in srgb, var(--indigo-50) 35%, var(--card)); }
.qt-in::placeholder { color: color-mix(in oklab, var(--mfg) 60%, transparent); }
.qt-num { text-align: right; font-variant-numeric: tabular-nums; }
.qt-qty { display: flex; align-items: center; }
.qt-qty .qt-in { padding-right: 4px; }
.qt-unit { flex: none; padding-right: 8px; font-size: 11px; color: var(--mfg); white-space: nowrap; }
.qt-amount { padding: 0 12px !important; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.qt-rm { width: 28px; height: 28px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; color: color-mix(in oklab, var(--mfg) 55%, transparent); transition: color .15s, background-color .15s; }
.qt-rm:hover { color: var(--destructive); background: var(--muted); }
.qt-table tr.enter td { animation: crl-flash 1.6s var(--ease); }
.qt-table tr.sel td { background: color-mix(in srgb, var(--indigo-50) 45%, transparent); }
.qt-addrow button { display: flex; align-items: center; gap: 6px; width: 100%; padding: 8px 12px; font-size: 13px; color: color-mix(in oklab, var(--mfg) 50%, transparent); transition: background-color .15s, color .15s; }
.qt-addrow button:hover { background: color-mix(in oklab, var(--muted) 40%, transparent); color: var(--fg); }
.qt-addrow button span { opacity: 0; transition: opacity .15s; }
.qt-addrow button:hover span, .qt-addrow button:focus-visible span { opacity: 1; }
.qt-sums { background: color-mix(in oklab, var(--muted) 30%, var(--card)); border-top: 1px solid var(--border); padding: 6px 0; }
.qt-sum { display: grid; grid-template-columns: 1fr 140px 40px; align-items: center; padding: 6px 0; font-size: 14px; }
.qt-sum span:first-child { text-align: right; color: var(--mfg); }
.qt-sum span:nth-child(2) { text-align: right; font-variant-numeric: tabular-nums; }
.qt-sum.total { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 10px; font-weight: 700; }
.qt-sum.total span:first-child { color: var(--fg); }
.qt-sum.total span:nth-child(2) { font-size: 16px; }
.qt-prod { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.qt-prod small { color: var(--mfg); font-size: 12px; white-space: nowrap; }
.crm-dialog.wide { max-width: 680px; }
.qt-paper-wrap { padding: 16px; background: #f4f4f5; max-height: min(62vh, 520px); overflow-y: auto; }
.qt-paper { background: #fff; padding: 28px 32px 36px; box-shadow: 0 1px 3px rgb(0 0 0 / .12); font-size: 11px; line-height: 1.5; color: #1f2937; }
.qt-paper .brandline { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.qt-paper .brandline b { font-size: 14px; color: #111827; }
.qt-paper .brandline .logo { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, #0ea5e9, #6366f1); }
.qt-paper .sender { margin-top: 26px; font-size: 8px; color: #6b7280; text-decoration: underline; }
.qt-paper .addr { margin-top: 4px; }
.qt-paper h5 { margin: 22px 0 2px; font-size: 16px; color: #111827; }
.qt-paper .meta { color: #6b7280; }
.qt-paper table { width: 100%; margin-top: 16px; border-collapse: collapse; }
.qt-paper th { padding: 6px 4px; border-bottom: 1px solid #111827; text-align: left; font-weight: 600; }
.qt-paper td { padding: 6px 4px; border-bottom: 1px solid #e5e7eb; vertical-align: top; }
.qt-paper .r { text-align: right; white-space: nowrap; }
.qt-paper .tot td { border: 0; padding: 3px 4px; }
.qt-paper .tot.grand td { font-weight: 700; font-size: 12px; border-top: 1px solid #111827; padding-top: 6px; }
.qt-paper .foot { margin-top: 26px; padding-top: 10px; border-top: 1px solid #e5e7eb; font-size: 8.5px; color: #6b7280; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.qt-attach { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--muted); font-size: 12px; }
textarea.crm-input { height: auto; min-height: 120px; padding-top: 24px; line-height: 1.5; resize: vertical; }

@container (max-width: 900px) {
  .qt-tabs { display: flex; gap: 4px; padding: 8px 12px 0; }
  .qt-tabs .crm-tab { flex: none; height: 32px; padding: 0 12px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--mfg); }
  .qt-tabs .crm-tab[aria-selected="true"] { background: var(--secondary); color: var(--fg); }
  .qt-body { grid-template-columns: minmax(0, 1fr); }
  .qt-left { border-right: 0; padding: 4px 12px 16px; }
  .qt-right { padding: 4px 12px 16px; }
  .crm-quote[data-tab="details"] .qt-right, .crm-quote[data-tab="items"] .qt-left { display: none; }
}
@container (max-width: 600px) {
  .qt-table col.c-check, .qt-table col.c-nr { width: 0; }
  .qt-table .qt-hide-sm { display: none; }
  .qt-table col.c-qty, .qt-table col.c-price { width: 76px; }
  .qt-table col.c-amount { width: 96px; }
  .qt-sum { grid-template-columns: 1fr 120px 12px; }
  .qt-paper { padding: 20px; }
}

/* =========================================================
   Dashboards (Kapitel „Dashboards“)
   ========================================================= */
.db-sel { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 8px; background: var(--secondary); font-size: 13px; font-weight: 500; white-space: nowrap; }
.db-sel:hover, .db-sel[aria-expanded="true"] { background: color-mix(in oklab, var(--secondary) 60%, var(--border)); }
.db-sel svg { color: var(--mfg); }
.db-sel span { max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
.db-period { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 8px; background: transparent; font-size: 13px; font-weight: 500; white-space: nowrap; }
.db-period:hover, .db-period[aria-expanded="true"] { background: var(--muted); }
.db-edit-btn[aria-pressed="true"] { background: var(--indigo-50); color: var(--indigo-600); }
/* Vollflächig wie im CRM (Stand v1.0.97): weiße Fläche, Widgets als Zellen mit Haarlinien */
.db-body { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 0; background: var(--card); }
.db-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 0; margin-right: -1px; }
.db-card { position: relative; grid-column: span 12; min-width: 0; padding: 16px 20px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--card); transition: background-color .15s; }
.db-card.enter { animation: crl-card-in .45s var(--ease); }
.db-kpi { grid-column: span 3; text-align: left; cursor: pointer; }
.db-hit { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.db-hit:focus-visible { outline: 2px solid color-mix(in oklab, var(--primary) 55%, transparent); outline-offset: 2px; }
.db-editing .db-hit { display: none; }
.db-kpi:hover { background: #fafafa; }
.db-kpi h5 { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0; font-size: 13px; font-weight: 500; color: var(--mfg); }
.db-kpi .v { display: block; margin-top: 12px; font-size: 26px; line-height: 1.1; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.db-kpi small { display: flex; align-items: center; gap: 4px; margin-top: 6px; font-size: 12px; color: var(--mfg); }
.db-kpi small b { font-weight: 600; color: var(--fg); }
.db-kpi small span { display: inline-flex; align-items: center; gap: 3px; }
.db-kpi small { flex-wrap: wrap; }
.db-kpi .up { color: #16a34a; } .db-kpi .down { color: #dc2626; } .db-kpi .red { color: #dc2626; font-weight: 600; }
/* Überfällig: nur Zahl + Hinweis rot, keine rote Kachel */
.db-kpi.warn .v, .db-kpi.warn small { color: #e11d48; }
.db-kpi.warn small { font-weight: 500; }
.db-ic-indigo { color: #6366f1; } .db-ic-green { color: #10b981; } .db-ic-amber { color: #f59e0b; } .db-ic-red { color: #e11d48; } .db-ic-blue { color: #3b82f6; }
.db-wide { grid-column: span 7; } .db-narrow { grid-column: span 5; } .db-half { grid-column: span 6; }
.db-card h4 { margin: 0; font-size: 14px; font-weight: 600; }
.db-card .sub { margin-top: 2px; font-size: 12px; color: var(--mfg); }
.db-chart text.future { opacity: .5; }
.db-fc { display: flex; flex-direction: column; gap: 22px; margin-top: 20px; }
.db-fc-row .hd { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; font-weight: 500; }
.db-fc-row .hd b { font-weight: 700; font-variant-numeric: tabular-nums; }
.db-fc-row.green .hd b { color: #059669; }
.db-fc-row .tr { height: 8px; margin-top: 8px; border-radius: 99px; background: #f4f4f5; overflow: hidden; }
.db-fc-row .tr i { display: block; height: 100%; border-radius: inherit; background: #6366f1; transform-origin: left; transition: transform .9s cubic-bezier(.16, 1, .3, 1); }
.db-fc-row.green .tr i { background: #10b981; }
.db-fc-foot { display: flex; align-items: center; justify-content: space-between; padding-top: 16px; border-top: 1px solid var(--border); font-size: 14px; }
.db-fc-foot span { color: var(--mfg); }
.db-fc-foot b { font-weight: 600; font-variant-numeric: tabular-nums; }
.db-chart { position: relative; margin-top: 14px; height: 230px; }
.db-chart svg { display: block; overflow: visible; }
.db-chart text { font-size: 11px; fill: var(--mfg); font-family: inherit; }
.db-tip { position: absolute; z-index: 5; pointer-events: none; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--card); box-shadow: 0 6px 16px -6px rgb(0 0 0 / .2); font-size: 12px; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); opacity: 0; transition: opacity .12s; }
.db-tip.on { opacity: 1; }
.db-tip b { display: block; font-weight: 600; }
.db-list { margin: 12px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.db-list li { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-top: 1px solid #f4f4f5; font-size: 13px; }
.db-list li:first-child { border-top: 0; }
.db-list .when { flex: none; width: 92px; font-size: 12px; color: var(--mfg); font-variant-numeric: tabular-nums; }
.db-list .dot { width: 8px; height: 8px; flex: none; border-radius: 50%; }
.db-list .t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Baukasten-Modus */
.db-editing .db-card { background: color-mix(in srgb, var(--indigo-50) 40%, var(--card)); cursor: default; }
.db-editing .db-kpi:hover { background: color-mix(in srgb, var(--indigo-50) 40%, var(--card)); }
.db-editing .db-kpi h5 > span { visibility: hidden; }
.db-rm { position: absolute; top: 8px; right: 8px; z-index: 3; width: 26px; height: 26px; border-radius: 50%; display: none; align-items: center; justify-content: center; background: var(--card); border: 1px solid var(--border); color: var(--mfg); box-shadow: 0 1px 2px rgb(0 0 0 / .06); }
.db-rm:hover { color: var(--destructive); border-color: #fecaca; }
.db-editing .db-rm { display: inline-flex; }
.db-add { grid-column: span 12; display: flex; align-items: center; justify-content: center; gap: 8px; height: 56px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: transparent; color: var(--indigo-600); font-size: 14px; font-weight: 500; }
.db-add:hover { background: color-mix(in srgb, var(--indigo-50) 60%, transparent); }
.db-editbar { grid-column: span 12; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 20px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--indigo-50) 60%, var(--card)); color: var(--indigo-600); font-size: 13px; }
@container (max-width: 900px) { .db-kpi { grid-column: span 6; } .db-wide, .db-narrow, .db-half { grid-column: span 12; } }
@container (max-width: 520px) { .db-kpi { grid-column: span 12; } .db-card { padding: 14px 16px; } .db-sel span { max-width: 110px; } }

/* =========================================================
   Planungsboard (Kapitel „Planungsboard“)
   ========================================================= */
.pl-date { font-size: 14px; font-weight: 600; white-space: nowrap; min-width: 88px; text-align: center; }
.pl-live { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px; border-radius: 999px; background: #ecfdf5; color: #059669; font-size: 10px; font-weight: 700; letter-spacing: .06em; }
.pl-live i { width: 6px; height: 6px; border-radius: 50%; background: #10b981; animation: crm-pulse 2s ease-in-out infinite; }
.pl-live[hidden] { display: none; }
.pl-body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 12px; background: #fafafa; }
.pl-upper { flex: none; display: flex; gap: 10px; min-height: 0; }
.pl-card { border: 1px solid var(--border); border-radius: 14px; background: var(--card); overflow: hidden; }
.pl-tl { flex: 1; min-width: 0; }
.pl-scroll { overflow-x: auto; overflow-y: hidden; }
.pl-grid { position: relative; }
.pl-head { display: flex; height: 36px; border-bottom: 1px solid var(--border); }
.pl-res-h { position: sticky; left: 0; z-index: 4; flex: none; width: 150px; display: flex; align-items: center; justify-content: center; gap: 8px; background: var(--card); border-right: 1px solid var(--border); font-size: 13px; font-weight: 500; color: var(--mfg); }
.pl-hour { flex: none; display: flex; align-items: center; justify-content: center; border-right: 1px solid #e4e4e7; font-size: 11px; font-weight: 600; color: #52525b; }
.pl-row { position: relative; display: flex; height: 50px; border-bottom: 1px solid #f4f4f5; }
.pl-row:last-child { border-bottom: 0; }
.pl-row.over .pl-lane { background: color-mix(in srgb, var(--indigo-50) 70%, transparent); }
.pl-res { position: sticky; left: 0; z-index: 4; flex: none; width: 150px; display: flex; align-items: center; gap: 10px; padding: 0 10px; background: var(--card); border-right: 1px solid var(--border); }
.pl-res .ini { width: 26px; height: 26px; flex: none; border-radius: 7px; display: flex; align-items: center; justify-content: center; background: #eef2ff; color: #4f46e5; font-size: 11px; font-weight: 700; border: 1px solid #e0e7ff; }
.pl-res > div { min-width: 0; }
.pl-res b { display: block; font-size: 13px; font-weight: 600; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-res small { display: block; font-size: 10px; color: var(--mfg); }
.pl-lane { position: relative; flex: none; transition: background-color .15s; background-image: linear-gradient(to right, #f1f1f3 1px, transparent 1px); background-size: calc(var(--hw) / 4) 100%; }
.pl-lane::after { content: ""; position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(to right, #e4e4e7 1px, transparent 1px); background-size: var(--hw) 100%; }
.pl-blk { position: absolute; top: 4px; bottom: 4px; z-index: 2; display: flex; flex-direction: column; justify-content: center; min-width: 0; padding: 2px 8px 2px 10px; border-radius: 6px; border: 1px solid #d4d4d8; background: var(--card); box-shadow: 0 1px 2px rgb(0 0 0 / .05); cursor: grab; overflow: hidden; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; transition: box-shadow .15s, border-color .15s, opacity .15s; }
.pl-blk::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c); }
.pl-blk:hover { border-color: #a1a1aa; box-shadow: 0 2px 6px rgb(0 0 0 / .08); }
.pl-blk b { font-size: 11px; line-height: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-blk small { font-size: 10px; line-height: 13px; color: var(--mfg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-blk.dragging { opacity: .35; }
.pl-blk.enter { animation: crl-card-in .5s var(--ease); }
.pl-blk.preview { opacity: .9; border-style: dashed; border-color: #818cf8; background: color-mix(in srgb, var(--indigo-50) 80%, #fff); box-shadow: none; pointer-events: none; z-index: 5; }
.pl-now { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #6366f1; z-index: 3; pointer-events: none; }
.pl-now::before { content: ""; position: absolute; top: -3px; left: -3px; width: 8px; height: 8px; border-radius: 50%; background: #6366f1; }
.pl-map { position: relative; flex: none; width: 38%; min-width: 220px; overflow: hidden; background: #aad3df; }
.pl-map[hidden] { display: none; }
.pl-map-in { position: absolute; left: 0; top: 0; width: 928px; height: 1179px; transform-origin: 0 0; transition: transform .6s var(--ease); }
.pl-map-in img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; }
.pl-map svg { position: absolute; inset: 0; overflow: visible; }
.pl-pin { position: absolute; z-index: 2; width: 24px; height: 30px; transform: translate(-50%, -100%) scale(var(--ps, 1)); transform-origin: 50% 100%; filter: drop-shadow(0 2px 3px rgb(0 0 0 / .35)); }
.pl-pin svg { position: absolute; inset: 0; }
.pl-pin span { position: absolute; left: 0; right: 0; top: 5px; text-align: center; color: #fff; font-size: 10px; font-weight: 700; line-height: 12px; }
.pl-pin.depot { width: 22px; height: 22px; transform: translate(-50%, -50%) scale(var(--ps, 1)); transform-origin: 50% 50%; border-radius: 6px; background: #18181b; border: 2px solid #fff; color: #fff; display: flex; align-items: center; justify-content: center; }
.pl-pin.depot span { position: static; display: flex; }
.pl-attr { position: absolute; right: 0; bottom: 0; z-index: 3; padding: 1px 5px; background: rgb(255 255 255 / .8); font-size: 9px; color: #52525b; }
.pl-attr a { color: inherit; }
.pl-maptip { position: absolute; z-index: 4; pointer-events: none; transform: translate(-50%, calc(-100% - 30px)); padding: 5px 8px; border-radius: 6px; background: var(--card); border: 1px solid var(--border); box-shadow: 0 6px 16px -6px rgb(0 0 0 / .25); font-size: 11px; white-space: nowrap; }
.pl-maptip b { display: block; font-size: 11px; }
.pl-split { flex: none; align-self: center; width: 40px; height: 4px; border-radius: 999px; background: #e4e4e7; }
.pl-list { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pl-list-top { flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.pl-seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--secondary); }
.pl-seg button { height: 28px; padding: 0 12px; border-radius: 8px; font-size: 13px; color: var(--mfg); }
.pl-seg button[aria-pressed="true"] { background: var(--card); color: var(--indigo-600); font-weight: 600; box-shadow: 0 1px 2px rgb(0 0 0 / .08); }
.pl-hint { font-size: 12px; color: var(--mfg); }
.pl-tbl-wrap { flex: 1; min-height: 0; overflow: auto; }
.pl-tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.pl-tbl th { position: sticky; top: 0; z-index: 1; padding: 8px 12px; background: color-mix(in oklab, var(--muted) 45%, var(--card)); border-bottom: 1px solid var(--border); text-align: left; font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--mfg); white-space: nowrap; }
.pl-tbl td { padding: 7px 12px; border-bottom: 1px solid #f4f4f5; color: #3f3f46; white-space: nowrap; }
.pl-tbl tr.pl-item { cursor: grab; transition: background-color .15s; }
.pl-tbl tr.pl-item:hover { background: #fafafa; }
.pl-tbl tr.pl-item.dragging { opacity: .4; }
.pl-tbl td.st { font-weight: 600; color: #18181b; }
.pl-tbl td.st.done { color: #059669; }
.pl-tbl .grip { color: #a1a1aa; vertical-align: middle; margin-right: 4px; display: inline-block; }
.pl-chip { position: fixed; z-index: 1000; pointer-events: none; padding: 6px 10px; border-radius: 8px; background: var(--card); border: 1px solid #a5b4fc; box-shadow: 0 10px 24px -8px rgb(0 0 0 / .3); font-size: 12px; font-weight: 600; white-space: nowrap; }
.crm.pl-chip-host { position: fixed; inset: auto; top: 0; left: 0; z-index: 1000; width: auto; height: auto; overflow: visible; background: transparent; pointer-events: none; }
.pl-pop { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.pl-pop h4 { display: flex; gap: 8px; font-size: 14px; line-height: 1.35; }
.pl-pop h4 i { width: 10px; height: 10px; margin-top: 4px; flex: none; border-radius: 3px; }
.pl-pop dl { margin: 0; display: grid; grid-template-columns: 18px 1fr; gap: 6px 8px; font-size: 12px; color: var(--mfg); }
.pl-pop dd { margin: 0; color: var(--fg); }
.pl-pop .row { display: flex; justify-content: flex-end; gap: 6px; }
.pl-pop .crm-btn { height: 30px; padding: 0 10px; font-size: 12px; }
@container (max-width: 760px) {
  .pl-upper { flex-direction: column; }
  .pl-map { width: auto; height: 190px; min-width: 0; }
  .pl-res, .pl-res-h { width: 120px; }
  .pl-res small { display: none; }
  .pl-hint { display: none; }
}

/* =========================================================
   Bewegung in den Vorschauen
   ========================================================= */
/* Ansichtswechsel (View Transitions): nur das umgeschaltete Element */
::view-transition-group(*.crm-vt) { animation-duration: .34s; animation-timing-function: cubic-bezier(.16, 1, .3, 1); }
::view-transition-old(*.crm-vt) { animation: crm-vt-out .16s ease both; }
::view-transition-new(*.crm-vt) { animation: crm-vt-in .36s cubic-bezier(.16, 1, .3, 1) both; }
::view-transition-old(*.next) { animation: crm-vt-out-next .2s ease both; }
::view-transition-new(*.next) { animation: crm-vt-in-next .38s cubic-bezier(.16, 1, .3, 1) both; }
::view-transition-old(*.prev) { animation: crm-vt-out-prev .2s ease both; }
::view-transition-new(*.prev) { animation: crm-vt-in-prev .38s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes crm-vt-out { to { opacity: 0; } }
@keyframes crm-vt-in { from { opacity: 0; transform: translateY(10px) scale(.994); } }
@keyframes crm-vt-out-next { to { opacity: 0; transform: translateX(-28px); } }
@keyframes crm-vt-in-next { from { opacity: 0; transform: translateX(28px); } }
@keyframes crm-vt-out-prev { to { opacity: 0; transform: translateX(28px); } }
@keyframes crm-vt-in-prev { from { opacity: 0; transform: translateX(-28px); } }

/* Hinweis-Puls auf dem ersten sinnvollen Klickziel jeder Vorschau (crm-hotspots.js) */
.crm-hot { outline: 2px solid transparent; }
@media (prefers-reduced-motion: no-preference) {
  .crm-hot { animation: crm-hot 1.9s ease-out infinite; }
}
@keyframes crm-hot { 0% { outline-color: rgb(99 102 241 / .8); outline-offset: 0; } 70%, 100% { outline-color: rgb(99 102 241 / 0); outline-offset: 8px; } }

/* Aufgabe abhaken: Kreis füllt sich, Titel wird durchgestrichen */
.crm-task.completing .crm-task-check { color: var(--primary); }
.crm-task.completing .crm-task-check svg { animation: crm-pop .38s cubic-bezier(.16, 1, .3, 1); }
.crm-task.completing .crm-task-title { background: linear-gradient(currentColor, currentColor) 0 58% / 0 1.5px no-repeat; animation: crm-strike .32s cubic-bezier(.16, 1, .3, 1) forwards; }
.crm-task.completing { animation: crm-fade-half .35s .25s ease forwards; }
@keyframes crm-pop { 0% { transform: scale(.6); } 100% { transform: scale(1); } }
@keyframes crm-strike { to { background-size: 100% 1.5px; } }
@keyframes crm-fade-half { to { opacity: .55; } }

/* Selbstlaufende Vorführung im Hero: Mauszeiger mit Klick-Welle */
.crm-cursor { position: absolute; left: 0; top: 0; z-index: 70; width: 22px; height: 22px; margin: -2px 0 0 -4px; pointer-events: none; opacity: 0; transition: transform .8s cubic-bezier(.45, 0, .2, 1), opacity .35s ease; filter: drop-shadow(0 2px 3px rgb(0 0 0 / .28)); }
.crm-cursor.on { opacity: 1; }
.crm-cursor svg { display: block; transition: transform .12s ease; }
.crm-cursor.press svg { transform: scale(.86); }
.crm-cursor i { position: absolute; left: -7px; top: -8px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgb(99 102 241 / .75); animation: crm-rip .55s ease-out forwards; }
@keyframes crm-rip { from { transform: scale(.25); opacity: 1; } to { transform: scale(1.9); opacity: 0; } }
.crm-autobadge { position: absolute; left: 50%; bottom: 14px; z-index: 65; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: rgb(24 24 27 / .82); color: #fff; font-size: 12px; font-weight: 500; pointer-events: none; opacity: 0; transition: opacity .3s ease; backdrop-filter: blur(6px); }
.crm-autobadge.on { opacity: 1; }
.crm-autobadge i { width: 6px; height: 6px; border-radius: 50%; background: #34d399; animation: crm-pulse 1.4s ease-in-out infinite; }

/* Kleine Rückmeldungen */
.crl-card { transition: border-color .15s, box-shadow .2s, opacity .15s, transform .2s cubic-bezier(.16, 1, .3, 1); }
.crl-card:hover { transform: translateY(-1px); box-shadow: 0 4px 12px -6px rgb(0 0 0 / .18); }
.crl-card.dragging:hover { transform: none; }
.cal-ev { transition: box-shadow .15s, opacity .15s, transform .2s cubic-bezier(.16, 1, .3, 1); }
.cal-ev:hover { transform: translateY(-1px); }
.qt-sum.total span:nth-child(2).bump { animation: crm-bump .45s cubic-bezier(.16, 1, .3, 1); }
@keyframes crm-bump { 0% { color: var(--indigo-600); transform: translateY(-3px); } 100% { color: inherit; transform: none; } }
.qt-sum span:nth-child(2) { display: inline-block; }
.pl-pin.drop { animation: pl-drop .55s cubic-bezier(.16, 1, .3, 1) both; animation-delay: var(--d, 0s); }
@keyframes pl-drop { from { opacity: 0; transform: translate(-50%, -165%) scale(var(--ps, 1)); } }
.db-chart rect[data-i] { transition: transform .9s cubic-bezier(.16, 1, .3, 1), filter .15s; }
.db-chart rect[data-i]:hover { filter: brightness(1.08); }
.crm-menu-item, .crm-picker-item, .crm-chip, .crl-vt, .cal-tab { transition: background-color .15s, color .15s; }
.crm-ib:active, .crm-btn:active, .crl-create:active, .qt-send:active { transform: scale(.96); }
.crm-ib, .crm-btn { transition: background-color .15s, color .15s, transform .1s; }
@media (prefers-reduced-motion: reduce) {
  .crl-card:hover, .cal-ev:hover { transform: none; }
  .crm-cursor { display: none; }
}

/* =========================================================
   Datensatz als Popup (CRMRecord.open aus crm-demo.js)
   ========================================================= */
.crm-modal-back {
  position: fixed; inset: 0; z-index: 95;
  display: flex; align-items: center; justify-content: center;
  padding: clamp(8px, 3vw, 32px);
  background: oklch(0.2 0.02 260 / 0.5);
  animation: crm-fade .22s ease;
}
.crm-modal-back.out { opacity: 0; transition: opacity .18s ease; }
.crm-modal {
  width: min(1120px, 100%); height: min(700px, 100%);
  border-radius: 12px; overflow: hidden; background: #fff;
  box-shadow: 0 30px 80px -20px rgb(15 23 42 / .5), 0 0 0 1px rgb(15 23 42 / .06);
  animation: crm-modal-in .38s cubic-bezier(.16, 1, .3, 1);
  outline: none;
}
.crm-modal-back.out .crm-modal { transform: scale(.98); transition: transform .18s ease; }
@keyframes crm-modal-in { from { opacity: 0; transform: translateY(14px) scale(.975); } }
.crm-host.crm-host-modal { height: 100%; min-height: 0; overflow: auto; background: #fff; }
.crm-host-modal .crm { height: 100%; }
@container (max-width: 760px) { .crm-host-modal .crm { height: auto; min-height: 100%; } }
html.crm-modal-open { overflow: hidden; }
.crm-num.order { border-color: #d1fae5; background: #ecfdf5; color: #059669; }
/* In Listen: Zeilen und Karten öffnen den Datensatz */
.crl-row, .crl-card { cursor: pointer; }
.crl-card { cursor: grab; }
@media (prefers-reduced-motion: reduce) { .crm-modal, .crm-modal-back { animation: none; } }
/* Auftragsübersicht im Hero: etwas höher als die Kapitel-Vorschauen */
.crm-host.crm-host-hero { min-height: 620px; }
.crm-host-hero .crm.crm-leads { height: 620px; }
@media (max-width: 760px) { .crm-host.crm-host-hero { min-height: 540px; } }
@container (max-width: 680px) { .crm-host-hero .crm.crm-leads { height: 540px; } }
.frame-browser.is-expanded .crm-host-hero .crm.crm-leads { height: 100%; }

/* Platzhalter der Hero-Vorschau: steht im HTML und ist mit dem ersten Bild da.
   crm-leads-demo.js ersetzt ihn, das Inline-Skript blendet ihn über der fertigen
   Vorschau aus. Maße wie .crl-rail / .crl-top / .crl-table. */
.crm-host-hero { position: relative; }
.crm-skel {
  --sk-bar: oklch(0.945 0.004 260);
  --sk-line: oklch(0.915 0.005 260);
  position: relative; display: flex; height: 620px; overflow: hidden;
  background: #fff; text-align: left;
}
html:not(.js) .crm-skel { display: none; }
.crm-skel.is-leaving { position: absolute; inset: 0; z-index: 5; height: auto; pointer-events: none; animation: sk-out .5s var(--ease-out, ease-out) forwards; }
.crm-skel::after {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(105deg, transparent 30%, rgb(255 255 255 / .8) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: sk-sweep 1.9s cubic-bezier(.4, 0, .2, 1) .3s infinite;
}
.sk-rail { flex: none; width: 56px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 0; border-right: 1px solid var(--sk-line); }
.sk-rail i { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.sk-rail i::before { content: ""; width: 16px; height: 16px; border-radius: 5px; background: var(--sk-bar); }
.sk-rail i.on { background: linear-gradient(135deg, #6366f1, #8b5cf6); box-shadow: 0 4px 10px -3px rgb(99 102 241 / .5); }
.sk-rail i.on::before { background: rgb(255 255 255 / .6); }
.sk-rail i.me { border-radius: 50%; background: oklch(0.965 0.005 260); }
.sk-rail span { flex: 1; }
.sk-app { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sk-top { flex: none; height: 52px; display: flex; align-items: center; gap: 6px; padding: 0 10px 0 12px; border-bottom: 1px solid var(--sk-line); }
.sk-top span { flex: 1; }
.sk-top b { flex: none; width: var(--w); height: 32px; border-radius: 8px; border: 1px solid var(--sk-line); }
.sk-top b.sk-cta { border: 0; background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.sk-row { display: grid; grid-template-columns: 44px 84px minmax(0, 1fr) 128px 150px 150px; align-items: center; height: 33px; border-bottom: 1px solid #f4f4f5; }
.sk-row > b { margin: 0 12px; display: block; width: var(--w); max-width: calc(100% - 24px); height: 8px; border-radius: 4px; background: var(--sk-bar); }
.sk-row > i { justify-self: center; width: 14px; height: 14px; border-radius: 4px; border: 1px solid oklch(0.87 0.006 260); }
.sk-row > b.sk-st { height: 20px; border-radius: 999px; background: color-mix(in srgb, var(--c) 16%, #fff); }
.sk-th { height: 31px; border-bottom-color: var(--sk-line); }
.sk-th > b { height: 7px; background: oklch(0.925 0.005 260); }
.sk-gh { display: flex; align-items: center; gap: 8px; height: 37px; padding: 0 12px; border-bottom: 1px solid #f4f4f5; background: #fcfcfc; }
.sk-gh em { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.sk-gh b { width: var(--w); height: 8px; border-radius: 4px; background: oklch(0.92 0.005 260); }
.sk-gh b + b { width: 20px; height: 16px; border-radius: 999px; background: var(--sk-bar); }
.sk-live {
  position: absolute; left: 50%; top: 50%; z-index: 2; translate: -50% -50%;
  display: inline-flex; align-items: center; gap: 10px; margin: 0;
  padding: 10px 18px 10px 14px; border-radius: 999px;
  background: #fff; border: 1px solid var(--sk-line);
  box-shadow: 0 1px 2px oklch(0.2 0.02 260 / .05), 0 14px 34px -14px oklch(0.2 0.02 260 / .28);
  font: 500 13px/1.2 var(--font-body, system-ui, sans-serif); color: oklch(0.32 0.012 260); white-space: nowrap;
  opacity: 0; animation: sk-live-in .7s var(--ease-out, ease-out) .6s forwards;
}
.sk-live i { position: relative; flex: none; width: 8px; height: 8px; border-radius: 50%; background: oklch(0.7 0.17 150); }
.sk-live i::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit; animation: sk-ping 1.5s cubic-bezier(0, 0, .2, 1) infinite; }
@keyframes sk-sweep { to { transform: translateX(100%); } }
@keyframes sk-ping { 75%, 100% { transform: scale(2.8); opacity: 0; } }
@keyframes sk-live-in { from { opacity: 0; translate: -50% calc(-50% + 8px); } to { opacity: 1; translate: -50% -50%; } }
@keyframes sk-out { to { opacity: 0; } }
@container (max-width: 900px) {
  .sk-rail, .sk-top .sk-lg, .sk-row > .sk-lg { display: none; }
  .sk-row { grid-template-columns: 44px 84px minmax(0, 1fr) 128px 150px; }
}
@container (max-width: 680px) {
  .crm-skel { height: 540px; }
  .sk-top .sk-md, .sk-row > .sk-md { display: none; }
  .sk-row { grid-template-columns: 44px 72px minmax(0, 1fr) 112px; }
}
@media (prefers-reduced-motion: reduce) {
  .crm-skel::after, .sk-live i::after { display: none; }
  .sk-live { animation: none; opacity: 1; }
  .crm-skel.is-leaving { animation-duration: .15s; }
}

/* =========================================================
   Formular-Editor (Kapitel „Formular-Editor“)
   ========================================================= */
.crm.crm-forms { flex-direction: row; height: 560px; }
.fe-pal { flex: none; width: 196px; overflow-y: auto; padding: 12px; border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 16px; background: var(--card); }
.fe-pal h5 { margin: 0 0 6px 2px; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #94a3b8; }
.fe-pal h5.custom { color: #818cf8; }
.fe-pal h5.widgets { color: #10b981; }
.fe-pal-list { display: grid; gap: 4px; }
.fe-pal-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border-radius: 6px; border: 1px solid #e2e8f0; background: #fff; font-size: 11px; font-weight: 500; text-align: left; cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; transition: border-color .15s, background-color .15s, transform .2s cubic-bezier(.16, 1, .3, 1), opacity .15s; }
.fe-pal-item svg { color: #94a3b8; }
.fe-pal-item:hover { border-color: #a5b4fc; background: #eef2ff; transform: translateX(2px); }
.fe-pal-item.custom { border-color: #e0e7ff; }
.fe-pal-item.widget { padding: 8px 9px; border-radius: 8px; border-color: rgb(167 243 208 / .8); background: linear-gradient(90deg, #ecfdf5, rgb(240 253 250 / .5)); color: #065f46; }
.fe-pal-item.widget svg { color: #059669; }
.fe-pal-item.used { opacity: .45; cursor: default; }
.fe-pal-item.used:hover { transform: none; background: #fff; border-color: #e2e8f0; }
.fe-pal-item.widget.used:hover { background: linear-gradient(90deg, #ecfdf5, rgb(240 253 250 / .5)); border-color: rgb(167 243 208 / .8); }
.fe-canvas { flex: 1; min-width: 0; display: flex; flex-direction: column; background: #f1f5f9; }
.fe-canvas-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px 8px; }
.fe-canvas-head h4 { margin: 0; font-size: 16px; font-weight: 700; color: #0f172a; }
.fe-canvas-head small { display: block; font-size: 10px; font-weight: 500; color: #94a3b8; }
.fe-actions { display: flex; align-items: center; gap: 8px; }
.fe-seg { display: inline-flex; padding: 3px; border-radius: 8px; background: #e2e8f0; }
.fe-seg button { height: 26px; padding: 0 10px; border-radius: 6px; font-size: 12px; font-weight: 500; color: #475569; }
.fe-seg button[aria-pressed="true"] { background: #fff; color: #0f172a; box-shadow: 0 1px 2px rgb(0 0 0 / .08); }
.fe-actions .crm-btn { height: 30px; padding: 0 10px; font-size: 11px; font-weight: 700; background: #fff; }
.fe-body { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 16px 20px; }
.fe-secs { display: flex; flex-direction: column; gap: 12px; }
.fe-sec { border: 1px solid #e2e8f0; border-radius: 10px; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .04); transition: border-color .15s, box-shadow .2s; }
.fe-sec.sel { border-color: #818cf8; box-shadow: 0 0 0 3px rgb(99 102 241 / .12); }
.fe-sec.enter { animation: crl-card-in .45s var(--ease); }
.fe-sec-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px 6px 10px; border-bottom: 1px solid #f1f5f9; background: rgb(248 250 252 / .6); border-radius: 10px 10px 0 0; cursor: pointer; }
.fe-sec-h .t { flex: 1; display: flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: #64748b; }
.fe-sec-h .t svg { color: #cbd5e1; }
.fe-sec-h .n { font-size: 10px; color: #94a3b8; font-weight: 500; }
.fe-x { width: 22px; height: 22px; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; color: #cbd5e1; opacity: 0; transition: opacity .15s, color .15s, background-color .15s; }
.fe-sec:hover .fe-sec-h .fe-x, .fe-field:hover .fe-x, .fe-x:focus-visible { opacity: 1; }
.fe-x:hover { color: var(--destructive); background: #fef2f2; }
.fe-grid { display: grid; gap: 8px; padding: 10px; min-height: 58px; }
.fe-field { position: relative; display: flex; align-items: center; gap: 8px; min-width: 0; padding: 8px 8px 8px 6px; border-radius: 8px; border: 1px solid #e2e8f0; background: #fff; cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; transition: border-color .15s, box-shadow .2s, transform .2s cubic-bezier(.16, 1, .3, 1), opacity .15s; }
.fe-field:hover { border-color: #c7d2fe; box-shadow: 0 2px 6px -2px rgb(0 0 0 / .1); }
.fe-field.sel { border-color: #6366f1; box-shadow: 0 0 0 3px rgb(99 102 241 / .14); }
.fe-field.dragging { opacity: .3; }
.fe-field.enter { animation: fe-drop .5s cubic-bezier(.16, 1, .3, 1); }
@keyframes fe-drop { from { opacity: 0; transform: scale(.94); box-shadow: 0 0 0 3px rgb(99 102 241 / .3); } }
.fe-field .grip { color: #cbd5e1; flex: none; }
.fe-field .lb { flex: 1; min-width: 0; }
.fe-field .lb b { display: block; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fe-field .lb b i { font-style: normal; color: #ef4444; }
.fe-field .lb small { display: block; font-size: 10px; color: #94a3b8; }
.fe-field.widget { border-color: rgb(167 243 208 / .9); background: linear-gradient(90deg, #ecfdf5, #fff); }
.fe-field.widget .lb b { color: #065f46; }
.fe-empty { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; min-height: 40px; border-radius: 8px; border: 1.5px dashed #cbd5e1; font-size: 11px; color: #94a3b8; }
.fe-ph { border-radius: 8px; border: 1.5px dashed #818cf8; background: rgb(238 242 255 / .7); min-height: 40px; animation: crm-fade .15s ease; }
.fe-grid.over { background: rgb(238 242 255 / .35); border-radius: 0 0 10px 10px; }
.fe-ghost { position: fixed; top: 0; left: 0; z-index: 1000; pointer-events: none; }
.crm.fe-ghost { width: auto; height: auto; overflow: visible; background: transparent; }
.fe-ghost .fe-chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 8px; border: 1px solid #818cf8; background: #fff; font-size: 12px; font-weight: 600; box-shadow: 0 12px 24px -8px rgb(0 0 0 / .28); transform: rotate(-1.5deg); }
/* Eigenschaften */
.fe-props { flex: none; width: 236px; overflow-y: auto; border-left: 1px solid var(--border); background: var(--card); }
.fe-props-h { padding: 12px 14px; border-bottom: 1px solid #f1f5f9; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #94a3b8; }
.fe-props-b { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.fe-props-b h6 { margin: 0; font-size: 15px; font-weight: 700; color: #0f172a; letter-spacing: -.01em; }
.fe-props-b p { font-size: 12px; color: var(--mfg); line-height: 1.5; }
.fe-lbl { display: block; margin-bottom: 4px; font-size: 10px; font-weight: 600; color: #94a3b8; }
.fe-in { width: 100%; height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid #e2e8f0; background: #fff; font-size: 13px; outline: 0; transition: border-color .15s, box-shadow .15s; }
.fe-in:focus { border-color: #818cf8; box-shadow: 0 0 0 3px rgb(99 102 241 / .12); }
select.fe-in { appearance: none; -webkit-appearance: none; padding-right: 28px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; }
.fe-switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 8px; background: #f8fafc; font-size: 12px; font-weight: 600; color: #475569; }
.fe-toggle { position: relative; width: 34px; height: 20px; border-radius: 999px; background: #cbd5e1; transition: background-color .2s; flex: none; }
.fe-toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .2); transition: transform .25s cubic-bezier(.16, 1, .3, 1); }
.fe-toggle[aria-checked="true"] { background: #6366f1; }
.fe-toggle[aria-checked="true"]::after { transform: translateX(14px); }
.fe-row2 { display: flex; gap: 6px; }
.fe-row2 .crm-btn { flex: 1; height: 30px; font-size: 12px; }
.fe-danger { color: var(--destructive) !important; }
/* Vorschau des fertigen Formulars */
.fe-prev { display: flex; flex-direction: column; gap: 18px; padding: 16px; border-radius: 10px; background: #fff; border: 1px solid #e2e8f0; box-shadow: 0 1px 2px rgb(0 0 0 / .04); }
.fe-prev h5 { margin: 0 0 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border); font-size: 15px; font-weight: 600; }
.fe-prev-grid { display: grid; gap: 12px; }
.fe-prev .req { color: #ef4444; }
.fe-wid { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); }
.fe-wid b { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.fe-wid b svg { color: var(--primary); }
.fe-wid span { display: block; height: 8px; margin-top: 6px; border-radius: 4px; background: #f1f5f9; }
.fe-wid span:nth-child(3) { width: 70%; }
@container (max-width: 760px) {
  .crm.crm-forms { flex-direction: column; height: 600px; }
  .fe-pal { width: auto; flex-direction: row; gap: 10px; overflow-x: auto; overflow-y: hidden; padding: 8px 10px; border-right: 0; border-bottom: 1px solid var(--border); }
  .fe-pal > div { flex: none; }
  .fe-pal-list { grid-auto-flow: column; grid-template-rows: repeat(2, auto); }
  .fe-pal-item { width: auto; white-space: nowrap; }
  .fe-props { position: absolute; left: 0; right: 0; bottom: 0; z-index: 20; width: auto; max-height: 55%; border-left: 0; border-top: 1px solid var(--border); border-radius: 14px 14px 0 0; box-shadow: 0 -10px 30px -12px rgb(0 0 0 / .25); transform: translateY(105%); transition: transform .3s cubic-bezier(.16, 1, .3, 1); }
  .crm-forms.has-sel .fe-props { transform: none; }
  .fe-canvas-head { flex-wrap: wrap; }
}
.fe-seg button { display: inline-flex; align-items: center; gap: 4px; }
.fe-row2 { flex-wrap: wrap; }
.fe-row2 .crm-btn { min-width: 0; padding: 0 6px; gap: 3px; font-size: 11px; }
