/*
 * Modul Kundenportal (docs/KUNDENPORTAL.md) – Kundenansicht (eigene App-Hülle) und Mitarbeiter-Ansicht. Präfix cp-.
 * Nur Tokens aus theme.css. Mobil zuerst: 390 px ohne horizontales Scrollen, Touch-Ziele ≥ 44 px, Eingaben ≥ 16 px.
 */

/* ================================================================== Mitarbeiter: Navigation & Zähler */
.cp-nav-badge {
  display: inline-grid; place-items: center; flex: none; margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--accent); color: var(--accent-contrast); font-size: 11px; font-weight: 700; line-height: 1;
}
.list-link > .cp-nav-badge { flex: none; }
.tab { position: relative; }
.cp-nav-dot {
  position: absolute; top: 9px; left: calc(50% + 7px); width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 2px var(--surface);
}
.cp-unread-banner {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; text-decoration: none !important; color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}
.cp-unread-banner:hover { background: var(--accent-soft); }
.cp-unread-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-strong); flex: none; }
.cp-unread-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.cp-unread-text .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ================================================================== Gemeinsam */
.cp-eyebrow { display: block; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--sage); }
.cp-stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.cp-section { min-width: 0; }
.card.cp-section:not(.card-pad) { padding: 16px; }
.cp-section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.cp-section-head .btn { min-width: 44px; }
.cp-section-title { display: flex; align-items: center; gap: 10px; font-size: var(--fs-lg); font-weight: 650; letter-spacing: -.01em; min-width: 0; }
.cp-section-icon {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: var(--brand-soft); color: var(--brand);
}
.cp-count {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-muted); font-size: var(--fs-xs); font-weight: 700; font-variant-numeric: tabular-nums;
}
.cp-card-title { font-size: var(--fs-lg); font-weight: 650; margin-bottom: 12px; }
.cp-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.cp-card-head .cp-card-title { margin-bottom: 2px; }
.cp-card-head p { margin: 0; }
.cp-empty-line { margin: 0; }
.cp-note-line { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; }
.cp-pad { padding: 16px; }
.cp-savebar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.cp-savebar > .muted { margin-right: auto; }
.cp-foot-note { display: flex; gap: 6px; align-items: flex-start; margin: 0; }
.cp-foot-note .icon { margin-top: 2px; }
.cp-text-danger { color: var(--danger); font-weight: 600; }

/* Töne für Symbole (Status) */
.cp-tone-neutral { background: var(--surface-3); color: var(--text-muted); }
.cp-tone-info { background: var(--info-soft); color: var(--info); }
.cp-tone-warning { background: var(--warning-soft); color: var(--warning); }
.cp-tone-success { background: var(--success-soft); color: var(--success); }
.cp-tone-danger { background: var(--danger-soft); color: var(--danger); }
.cp-tone-brand { background: var(--brand-soft); color: var(--brand); }

/* Fortschritt */
.cp-progress { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cp-progress-track { position: relative; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .22); overflow: hidden; }
.cp-progress-track > span { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: currentColor; transition: width .4s ease-out; }
.cp-progress-text { font-size: var(--fs-sm); font-weight: 600; opacity: .92; }

/* ================================================================== Kunden-App: Hülle */
.cp-app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
.cp-skip {
  position: absolute; left: 12px; top: -80px; z-index: 300; display: inline-flex; align-items: center; min-height: 44px; padding: 10px 14px;
  border-radius: var(--radius-sm); background: var(--brand); color: var(--brand-contrast); font-weight: 600;
}
.cp-skip:focus { top: 10px; }
/* Kein backdrop-filter: er würde fixierte Nachfahren (Konto-Menü als Bottom-Sheet) an die Kopfzeile binden */
.cp-header {
  position: sticky; top: 0; z-index: 30; background: var(--surface);
  border-bottom: 1px solid var(--border); padding-top: env(safe-area-inset-top);
}
.cp-header:has(.modal-backdrop) { z-index: 150; }
.cp-header-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 60px;
  max-width: 1160px; margin: 0 auto; padding: 0 max(12px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left));
}
.cp-brand { display: flex; align-items: center; gap: 12px; min-height: 44px; min-width: 44px; color: var(--text); text-decoration: none !important; flex: none; }
.cp-logo { display: inline-flex; align-items: center; gap: 10px; }
.cp-logo-mark { width: 34px; height: 34px; padding: 3px; border-radius: 9px; background: #fff; border: 1px solid var(--border); object-fit: contain; }
.cp-logo-text { height: 15px; width: auto; display: block; }
.cp-brand-label {
  padding-left: 12px; border-left: 1px solid var(--border-strong); color: var(--text-muted);
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap;
}
.cp-header-right { display: flex; align-items: center; gap: 6px; min-width: 0; }
.cp-room {
  position: relative; display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 340px; min-height: 44px; padding: 4px 10px;
  border: 1px solid transparent; border-radius: var(--radius); background: transparent; color: var(--text); font: inherit; text-align: left;
}
.cp-room.is-switch { cursor: pointer; border-color: var(--border); background: var(--surface); }
.cp-room.is-switch:hover { border-color: var(--border-strong); background: var(--surface-2); }
.cp-room:disabled { opacity: 1; cursor: default; }
.cp-room-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.cp-room-label { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); }
.cp-room-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-room .icon { color: var(--text-muted); }
.cp-room-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.cp-account .btn-icon { border-radius: 50%; background: var(--brand-soft); color: var(--brand-strong); }
.cp-account .btn-icon:hover { background: var(--surface-3); }

/* Bereiche (Desktop): unterstrichene Reiter unter der Kopfzeile */
.cp-tabs { border-top: 1px solid var(--border); }
.cp-tabs-inner { display: flex; gap: 4px; max-width: 1160px; margin: 0 auto; padding: 0 14px; overflow-x: auto; scrollbar-width: none; }
.cp-tabs-inner::-webkit-scrollbar { display: none; }
.cp-tab {
  position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 12px 12px 13px; white-space: nowrap;
  color: var(--text-muted); font-weight: 600; text-decoration: none !important; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.cp-tab:hover { color: var(--text); background: var(--surface-2); }
.cp-tab.is-active { color: var(--brand-strong); }
.cp-tab.is-active::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--brand); }
.cp-tab-badge {
  display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 6px; border-radius: 999px;
  background: var(--accent); color: var(--accent-contrast); font-size: 11px; font-weight: 700; line-height: 1;
}

.cp-main {
  flex: 1; width: 100%; max-width: 1160px; margin: 0 auto; outline: none;
  padding: 16px max(14px, env(safe-area-inset-right)) 28px max(14px, env(safe-area-inset-left));
}
.cp-app.has-tabs .cp-main { padding-bottom: calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom)); }
.cp-footer {
  display: flex; justify-content: center; gap: 6px 18px; flex-wrap: wrap; padding: 4px 16px 20px; color: var(--text-faint); font-size: var(--fs-xs);
}
.cp-footer span { display: inline-flex; align-items: center; gap: 5px; }
.cp-app.has-tabs .cp-footer { display: none; }

/* Handy: Tab-Leiste unten (wie Mitarbeiter-App), Spaltenzahl = Anzahl Bereiche */
.cp-tabbar { grid-template-columns: repeat(var(--cp-tabs, 5), 1fr); }
.cp-tabbar .tab { min-width: 0; border: 0; background: none; font: inherit; font-size: 11px; font-weight: 500; cursor: pointer; padding: 0 2px; }
.cp-tabbar .tab > span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-tab-icon { position: relative; display: inline-flex; }
.cp-tab-icon .cp-tab-badge { position: absolute; top: -6px; left: 14px; min-width: 18px; height: 18px; font-size: 10px; box-shadow: 0 0 0 2px var(--surface); }
.cp-more-list { margin: 0 -18px; }
.cp-more-list .list-link.is-active { color: var(--brand-strong); font-weight: 650; }

@media (min-width: 900px) {
  .cp-header-inner { height: 68px; padding: 0 24px; }
  .cp-tabs-inner { padding: 0 24px; }
  .cp-main { padding: 28px 24px 40px; }
  .cp-app.has-tabs .cp-main { padding-bottom: 40px; }
  .cp-app.has-tabs .cp-footer { display: flex; }
  .cp-logo-mark { width: 38px; height: 38px; }
  .cp-logo-text { height: 17px; }
}
@media (max-width: 899px) {
  .cp-brand-label { display: none; }
  .cp-room { max-width: 62vw; }
  .cp-room:not(.is-switch) { padding-right: 4px; }
}

/* Hinweis 2FA */
.cp-banner { background: var(--info-soft); color: var(--text); border-bottom: 1px solid color-mix(in srgb, var(--info) 22%, transparent); }
.cp-banner-inner {
  display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; max-width: 1160px; margin: 0 auto;
  padding: 10px max(14px, env(safe-area-inset-right)) 10px max(14px, env(safe-area-inset-left)); font-size: var(--fs-sm);
}
.cp-banner-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--surface); color: var(--info); flex: none; }
.cp-banner-text { flex: 1 1 240px; min-width: 0; }
.cp-banner-actions { display: flex; gap: 6px; margin-left: auto; }
@media (min-width: 900px) { .cp-banner-inner { padding: 10px 24px; } }

/* Seitenkopf der Bereiche */
.cp-page { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.cp-page-head { display: flex; flex-direction: column; gap: 4px; margin: 2px 0 2px; min-width: 0; }
.cp-page-head .cp-eyebrow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-page-title { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.cp-page-sub { margin: 0; color: var(--text-muted); }
@media (min-width: 900px) { .cp-page-title { font-size: 32px; } }

/* ================================================================== Cockpit */
.cp-cockpit { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.cp-hero {
  position: relative; overflow: hidden; border-radius: 20px; padding: 22px 20px 20px; isolation: isolate;
  background: linear-gradient(135deg, var(--brand-strong) 0%, var(--brand) 58%, color-mix(in srgb, var(--brand) 72%, var(--sage)) 100%);
  color: var(--brand-contrast); box-shadow: var(--shadow);
}
.cp-hero-art { position: absolute; z-index: -1; right: -40px; top: -30px; width: 280px; height: 280px; opacity: .9; pointer-events: none; }
.cp-hero-art polygon { fill: currentColor; opacity: .07; }
.cp-hero-art .b { fill: var(--sage-soft); opacity: .16; }
.cp-hero-art .arc { fill: none; stroke: var(--sage-soft); stroke-width: 5; stroke-linecap: round; opacity: .28; }
.cp-hero-body { display: flex; flex-direction: column; gap: 6px; max-width: 720px; min-width: 0; }
.cp-hero-eyebrow { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; opacity: .8; }
.cp-hero-title { font-size: 27px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; overflow-wrap: anywhere; }
.cp-hero-space { display: flex; align-items: center; gap: 8px; margin: 2px 0 0; font-size: var(--fs-lg); font-weight: 600; min-width: 0; }
.cp-hero-space span { overflow-wrap: anywhere; }
.cp-hero-text { margin: 4px 0 0; opacity: .92; max-width: 60ch; white-space: pre-line; }
.cp-hero-foot { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.cp-hero-foot .cp-progress { max-width: 420px; }
.cp-hero-ms { margin: 0; font-size: var(--fs-sm); opacity: .95; }
.cp-hero-ms .icon { vertical-align: -2px; }
@media (min-width: 900px) {
  .cp-hero { padding: 34px 36px 30px; border-radius: 24px; }
  .cp-hero-title { font-size: 36px; }
  .cp-hero-art { width: 380px; height: 380px; right: -30px; top: -60px; }
  .cp-hero-foot { flex-direction: row; align-items: flex-end; justify-content: space-between; gap: 24px; }
  .cp-hero-foot .cp-progress { flex: 1; }
}

.cp-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.cp-col-main, .cp-col-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (min-width: 1000px) { .cp-grid { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } .cp-col-side { position: sticky; top: 132px; } }
/* Eine Spalte (Handy/Tablet): ungelesene Nachrichten direkt nach «Braucht Ihre Aufmerksamkeit», Übriges danach */
@media (max-width: 999px) {
  .cp-col-main, .cp-col-side { display: contents; }
  .cp-attention { order: 1; }
  .cp-chat-teaser { order: 6; }
  .cp-chat-teaser.has-unread { order: 2; }
  .cp-sec-progress { order: 3; }
  .cp-sec-next { order: 4; }
  .cp-sec-done { order: 5; }
  .cp-sec-docs { order: 7; }
  .cp-sec-team { order: 8; }
}

/* Braucht Ihre Aufmerksamkeit */
.cp-attention.has-items { border-color: color-mix(in srgb, var(--warning) 35%, var(--border)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warning) 9%, transparent), var(--shadow-sm); }
.cp-attention.is-clear { background: linear-gradient(180deg, var(--success-soft), var(--surface) 70%); }
.cp-clear { margin: 0; color: var(--text-muted); }
.cp-att-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cp-att {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--border); min-width: 0;
}
.cp-att-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; flex: none; }
.cp-att-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.cp-att > .btn { align-self: center; flex: none; }
@media (max-width: 519px) {
  .cp-att { flex-wrap: wrap; }
  .cp-att-text { flex-basis: calc(100% - 52px); }
  .cp-att > .btn { margin-left: 50px; }
}

/* Zeitleiste der Schritte */
.cp-timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.cp-step { position: relative; display: flex; gap: 14px; padding: 0 0 18px; min-width: 0; }
.cp-step:last-child { padding-bottom: 0; }
.cp-step::before { content: ''; position: absolute; left: 13px; top: 30px; bottom: 2px; width: 2px; border-radius: 2px; background: var(--border); }
.cp-step:last-child::before { display: none; }
.cp-step-dot { position: relative; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; flex: none; box-shadow: 0 0 0 4px var(--surface); }
.cp-kind-milestone .cp-step-dot { border-radius: 8px; transform: rotate(0deg); }
.cp-step-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; padding-top: 3px; }
.cp-step-kind { display: inline-block; margin-right: 6px; font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--sage); }
.cp-step-title { font-weight: 650; overflow-wrap: anywhere; }
.cp-step-text { color: var(--text-muted); font-size: var(--fs-sm); white-space: pre-line; overflow-wrap: anywhere; }
.cp-step-meta { display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; margin-top: 2px; font-size: var(--fs-sm); color: var(--text-muted); }
.cp-due { display: inline-flex; align-items: center; gap: 5px; }
.cp-due.is-overdue { color: var(--danger); font-weight: 600; }
.cp-owner { display: inline-flex; align-items: center; gap: 5px; }
.cp-owner::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong); }
.cp-timeline-done .cp-step-title { color: var(--text-muted); font-weight: 600; }
.cp-more { margin-top: 10px; }

/* Seitenspalte */
.cp-chat-teaser.has-unread { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.cp-last-msg { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; min-width: 0; }
.cp-last-msg-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cp-last-msg-sys { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; flex: none; background: var(--sage-soft); color: var(--sage); }
.cp-last-msg-body { color: var(--text-muted); font-size: var(--fs-sm); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.cp-chat-teaser .cp-empty-line:empty { display: none; }
.cp-chat-teaser .cp-empty-line { margin-bottom: 12px; }
.cp-team { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.cp-team li { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cp-team-text { display: flex; flex-direction: column; min-width: 0; }

/* ================================================================== Dokumente */
.cp-files { position: relative; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.cp-files-bar { display: flex; flex-direction: column; gap: 12px; }
.cp-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px; margin: -2px; scrollbar-width: thin; }
.cp-chips .chip { flex: none; }
.cp-chip-n { color: var(--text-faint); font-variant-numeric: tabular-nums; }
.chip.is-active .cp-chip-n { color: inherit; opacity: .75; }
.cp-files-add { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }
.cp-files-hint { flex: 1 1 200px; }
.cp-folder + .cp-folder { margin-top: 6px; }
.cp-folder-title { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: var(--fs-sm); font-weight: 700; color: var(--text-muted); }
.cp-file-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cp-file { display: flex; align-items: center; gap: 4px; padding-right: 6px; background: var(--surface); border-bottom: 1px solid var(--border); min-width: 0; }
.cp-file:last-child { border-bottom: 0; }
.cp-file.is-hidden { background: repeating-linear-gradient(135deg, var(--surface), var(--surface) 10px, var(--surface-2) 10px, var(--surface-2) 20px); }
.cp-file-main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; min-height: 60px; padding: 10px 6px 10px 12px; color: var(--text); text-decoration: none !important; }
.cp-file:hover { background: var(--surface-2); }
.cp-file-main:hover .cp-file-dl { color: var(--brand); }
.cp-file-glyph { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; flex: none; background: var(--surface-3); color: var(--text-muted); }
.cp-file-pdf { background: var(--danger-soft); color: var(--danger); }
.cp-file-png, .cp-file-jpg, .cp-file-jpeg, .cp-file-heic, .cp-file-heif { background: var(--info-soft); color: var(--info); }
.cp-file-xlsx, .cp-file-csv { background: var(--success-soft); color: var(--success); }
.cp-file-docx { background: var(--brand-soft); color: var(--brand); }
.cp-file-pptx { background: var(--accent-soft); color: var(--accent-strong); }
.cp-file-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.cp-file-name { font-weight: 600; overflow-wrap: anywhere; }
.cp-file-meta { font-size: var(--fs-sm); color: var(--text-muted); }
.cp-file-note { font-size: var(--fs-sm); color: var(--text); font-style: italic; overflow-wrap: anywhere; }
.cp-file-badges { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.cp-file-dl { color: var(--text-faint); flex: none; padding: 0 4px; }
.cp-file-busy { display: grid; place-items: center; width: 44px; height: 44px; }
.cp-file-list-compact { border: 0; border-radius: 0; margin: 0 -8px; }
.cp-file-list-compact .cp-file { border-bottom: 0; padding: 0; background: none; }
.cp-file-list-compact .cp-file-main { min-height: 52px; padding: 6px 8px; border-radius: var(--radius-sm); }
.cp-file-list-compact .cp-file-glyph { width: 34px; height: 34px; border-radius: 9px; }
.cp-files-empty, .cp-chat-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 28px 12px; }
.cp-files-empty p, .cp-chat-empty p { max-width: 420px; margin: 0; }
.cp-files-empty-icon, .cp-chat-empty-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); margin-bottom: 4px; }
.cp-drop {
  position: absolute; inset: -6px; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  border: 2px dashed var(--brand); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--brand-soft) 88%, transparent);
  color: var(--brand-strong); font-weight: 650; pointer-events: none;
}
.cp-upload-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cp-upload-list li { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); }
.cp-upload-list .ellipsis { flex: 1; }
.cp-check-line { min-height: 44px; }
@media (min-width: 720px) { .cp-chips { flex-wrap: wrap; overflow: visible; } }

/* ================================================================== Chat */
.cp-chat-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; height: calc(100dvh - 300px); min-height: 380px; }
.cp-room-page .cp-chat-card { height: min(70vh, 720px); min-height: 420px; }
/* Mitarbeitende am Handy: Reiter oben (scrollIntoView), Chat füllt den Rest bis zur Tab-Leiste – Eingabe sichtbar */
@media (max-width: 899px) {
  .cp-room-page .cp-subtabs { scroll-margin-top: calc(var(--topbar-h) + env(safe-area-inset-top)); }
  .cp-room-page .cp-chat-card {
    height: calc(100dvh - var(--topbar-h) - var(--tabbar-h) - 44px - 30px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    min-height: 320px;
  }
  .content:has(.cp-room-page .cp-chat-card) { padding-bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom)); }
}
@media (max-width: 599px) {
  .cp-room-page .cp-chat-card { height: calc(100dvh - var(--topbar-h) - var(--tabbar-h) - 56px - 30px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
}
@media (max-width: 899px) {
  .cp-page-chat .cp-page-sub { display: none; }
  .cp-page-chat .cp-chat-card {
    height: calc(100dvh - 60px - var(--tabbar-h) - 128px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    min-height: 340px; margin: 0 -2px;
  }
  .cp-app.has-tabs:has(.cp-page-chat) .cp-main { padding-bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom)); }
}
@media (min-width: 900px) { .cp-page-chat .cp-chat-card { height: calc(100vh - 330px); min-height: 460px; } }
.cp-chat { position: relative; display: flex; flex-direction: column; flex: 1; min-height: 0; }
.cp-chat-list {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 12px 10px;
  display: flex; flex-direction: column; gap: 2px; scroll-behavior: auto;
}
.cp-chat-list:focus-visible { outline-offset: -2px; border-radius: 0; }
.cp-chat-list > .loading, .cp-chat-empty { margin: auto 0; }
.cp-day { display: flex; justify-content: center; margin: 14px 0 8px; }
.cp-day span { padding: 3px 12px; border-radius: 999px; background: var(--surface-3); color: var(--text-muted); font-size: var(--fs-xs); font-weight: 600; box-shadow: var(--shadow-sm); }
.cp-msg { display: flex; gap: 8px; margin-top: 10px; min-width: 0; }
.cp-msg.is-grouped { margin-top: 3px; }
.cp-msg.is-own { justify-content: flex-end; }
.cp-msg-avatar { width: 32px; flex: none; }
.cp-msg-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; max-width: min(86%, 620px); }
.cp-msg.is-own .cp-msg-main { align-items: flex-end; }
.cp-msg-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 0 4px; font-size: var(--fs-xs); color: var(--text-faint); }
.cp-msg-name { font-weight: 700; color: var(--text-muted); }
.cp-msg-tag { padding: 0 6px; border-radius: 999px; background: var(--surface-3); color: var(--text-muted); font-weight: 700; font-size: 10px; letter-spacing: .04em; text-transform: uppercase; }
.cp-msg-tag.is-sanom { background: var(--brand-soft); color: var(--brand-strong); }
.cp-msg-row { display: flex; align-items: center; gap: 2px; min-width: 0; max-width: 100%; }
.cp-msg.is-own .cp-msg-row { flex-direction: row-reverse; }
.cp-bubble {
  position: relative; min-width: 0; padding: 9px 13px; border-radius: 18px 18px 18px 6px;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border); overflow-wrap: anywhere;
}
.cp-msg.is-sanom:not(.is-own) .cp-bubble { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 18%, transparent); }
.cp-msg.is-own .cp-bubble { border-radius: 18px 18px 6px 18px; background: var(--brand); color: var(--brand-contrast); border-color: transparent; }
.cp-msg.is-own .cp-bubble a { color: inherit; text-decoration: underline; }
.cp-msg.is-editing .cp-bubble { box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 4px var(--accent); }
.cp-msg-text { margin: 0; white-space: pre-wrap; }
.cp-msg-edited, .cp-msg-time-inline { font-size: 11px; opacity: .7; margin-left: 6px; }
.cp-msg-time-inline { float: right; margin: 6px 0 0 10px; }
.cp-msg-deleted { display: inline-flex; align-items: center; gap: 6px; font-style: italic; opacity: .75; }
.cp-msg-text + .cp-msg-removed { margin-top: 6px; display: flex; }
.cp-older { display: flex; justify-content: center; padding: 2px 0 6px; }
.cp-older .btn { gap: 6px; }
.cp-sys .cp-msg-actions { margin: -6px -8px -6px 0; }
.cp-msg-file {
  display: flex; align-items: center; gap: 10px; margin-top: 6px; padding: 8px 10px; min-width: 0; max-width: 320px;
  border-radius: 12px; background: var(--surface); color: var(--text) !important; text-decoration: none !important; border: 1px solid var(--border);
}
.cp-msg-text + .cp-msg-file { margin-top: 8px; }
.cp-bubble > .cp-msg-file:first-child { margin-top: 0; }
.cp-msg-file:hover { border-color: var(--brand); }
.cp-msg-file .cp-file-glyph { width: 34px; height: 34px; border-radius: 8px; }
.cp-msg-file-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.cp-msg-file-text .small { color: var(--text-muted); }
.cp-msg-actions { flex: none; opacity: .55; transition: opacity .12s; }
.cp-msg:hover .cp-msg-actions, .cp-msg-actions:focus-within { opacity: 1; }
.cp-sys {
  display: flex; align-items: flex-start; gap: 8px; align-self: center; max-width: min(92%, 640px); margin: 12px auto 4px; padding: 8px 14px;
  border-radius: 14px; background: var(--sage-soft); color: var(--text); font-size: var(--fs-sm); text-align: left; overflow-wrap: anywhere;
}
.cp-sys > .icon { color: var(--sage); flex: none; margin-top: 3px; }
.cp-sys-time { margin-left: auto; padding: 2px 0 0 6px; font-size: 11px; color: var(--text-faint); flex: none; }
.cp-jump {
  position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 2; display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  color: var(--brand-strong); font: inherit; font-size: var(--fs-sm); font-weight: 650; cursor: pointer; box-shadow: var(--shadow-lg);
}
.cp-composer { border-top: 1px solid var(--border); background: var(--surface); padding: 10px 10px calc(10px + 0px); display: flex; flex-direction: column; gap: 8px; }
.cp-composer.is-editing { background: var(--accent-soft); }
.cp-composer-ro { flex-direction: row; align-items: center; gap: 8px; padding: 14px 16px; }
.cp-composer-row { display: flex; align-items: flex-end; gap: 6px; }
.cp-composer textarea.cp-composer-input { flex: 1; min-height: 44px; height: 44px; max-height: 168px; resize: none; border-radius: 22px; padding: 10px 16px; line-height: 1.4; overflow-y: auto; }
.cp-attach, .cp-send { width: 44px; min-width: 44px; height: 44px; border-radius: 50%; flex: none; }
.cp-send:disabled { opacity: .45; }
.cp-composer-hint { margin: 0 0 0 54px; font-size: var(--fs-xs); color: var(--text-faint); }
.cp-composer-note { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); font-weight: 650; color: var(--accent-strong); }
.cp-composer-note .btn { margin-left: auto; }
.cp-attach-chip { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 4px 4px 4px 10px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.cp-attach-chip .ellipsis { flex: 1; font-weight: 600; font-size: var(--fs-sm); }
@media (min-width: 900px) { .cp-chat-list { padding: 18px 22px 12px; } .cp-composer { padding: 12px 16px; } }

/* ================================================================== Offerten & Rechnungen */
.cp-doc-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
@media (min-width: 820px) { .cp-doc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cp-doc { display: flex; flex-direction: column; gap: 12px; padding: 18px; min-width: 0; }
.cp-doc.is-pending { border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 10%, transparent), var(--shadow-sm); }
.cp-doc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.cp-doc-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cp-doc-title h3 { font-size: var(--fs-lg); font-weight: 650; overflow-wrap: anywhere; }
.cp-doc-no { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); }
.cp-doc-amount { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.cp-doc-amount-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.cp-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px 16px; margin: 0; }
.cp-facts div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cp-facts dt { font-size: var(--fs-xs); color: var(--text-faint); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.cp-facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.cp-doc-note { margin: 0; }
.cp-doc-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; border-top: 1px solid var(--border); padding-top: 12px; }
.cp-doc-spacer { flex: 1; }
@media (max-width: 519px) {
  .cp-doc-spacer { flex-basis: 100%; height: 0; }
  .cp-doc.is-pending .cp-doc-actions .btn-primary, .cp-doc.is-pending .cp-doc-actions .btn-ghost:not(.btn-icon) { flex: 1; }
}
.cp-sum-box { display: flex; flex-direction: column; gap: 3px; padding: 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.cp-sum-amount { font-size: var(--fs-xl); font-weight: 700; font-variant-numeric: tabular-nums; }
.cp-confirm { align-items: flex-start; gap: 10px; padding: 12px; border-radius: var(--radius); background: var(--brand-soft); line-height: 1.4; }
.cp-confirm input { margin-top: 2px; flex: none; }
.cp-legal { display: flex; gap: 6px; align-items: flex-start; margin: 0; }
.cp-legal .icon { margin-top: 2px; }

.cp-kpis { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 480px) { .cp-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cp-kpis-3 { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .cp-kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cp-kpi { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); min-width: 0; }
.cp-kpi-label { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.cp-kpi-value { font-size: 22px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.cp-kpi.is-danger { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.cp-kpi.is-danger .cp-kpi-value { color: var(--danger); }
.cp-kpi.is-strong { background: linear-gradient(135deg, var(--brand-strong), var(--brand)); color: var(--brand-contrast); border-color: transparent; }
.cp-kpi.is-strong .cp-kpi-label { color: inherit; opacity: .8; }
@media (min-width: 900px) { .cp-kpi-value { font-size: 26px; } }

.cp-list-card { padding: 4px 0; overflow: hidden; }
.cp-inv-list { list-style: none; margin: 0; padding: 0; }
.cp-inv {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'main amount' 'badge actions';
  align-items: center; gap: 8px 12px; padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.cp-inv:last-child { border-bottom: 0; }
.cp-inv.is-overdue { background: color-mix(in srgb, var(--danger-soft) 55%, transparent); }
.cp-inv-main { grid-area: main; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cp-inv-title { overflow-wrap: anywhere; }
.cp-inv-amount { grid-area: amount; display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.cp-inv-value { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cp-inv > .badge { grid-area: badge; justify-self: start; }
.cp-inv-actions { grid-area: actions; display: flex; gap: 4px; justify-content: flex-end; }
@media (min-width: 760px) {
  .cp-inv { grid-template-columns: minmax(0, 1fr) 150px 110px auto; grid-template-areas: 'main amount badge actions'; padding: 12px 18px; }
  .cp-inv > .badge { justify-self: center; }
}

/* ================================================================== Vermögen */
.cp-pf-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; padding: 18px; }
.cp-pf-title { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -.01em; margin-top: 2px; }
.cp-pf-head p { margin: 4px 0 0; }
.cp-pf-date { display: flex; align-items: flex-end; gap: 6px; }
.cp-pf-date .field { flex: none; }
.cp-pf-list { list-style: none; margin: 0 -16px -16px; padding: 0; }
.cp-pf-pos { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.cp-pf-pos-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 180px; }
.cp-pf-pos-name { font-weight: 650; overflow-wrap: anywhere; }
.cp-pf-pos-val { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; flex: 1 1 150px; }
.cp-pf-amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cp-pf-amount.is-liability { color: var(--danger); }
.cp-pf-src { color: var(--text-muted); }
.cp-stack.is-loading { opacity: .6; transition: opacity .15s; }

/* ================================================================== Konto */
.cp-account-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 900px) { .cp-account-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }
.cp-me { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cp-me-text { display: flex; flex-direction: column; min-width: 0; }
.cp-2fa.is-recommended { border-color: color-mix(in srgb, var(--warning) 35%, var(--border)); }
.cp-2fa { scroll-margin-top: calc(76px + env(safe-area-inset-top)); } /* unter der fixierten Kopfzeile (Sprung «Jetzt einrichten») */
.cp-2fa .cp-card-title:focus { outline: none; }
.cp-2fa .cp-card-head { margin-bottom: 8px; }
.cp-2fa-text { display: flex; gap: 10px; align-items: flex-start; margin: 0; }
.cp-2fa-text .icon { color: var(--success); margin-top: 2px; }
.cp-2fa-text.is-off .icon { color: var(--warning); }
.cp-2fa-setup { display: flex; flex-direction: column; gap: 12px; }
.cp-2fa-qr { display: flex; justify-content: center; align-self: center; }
.cp-steps-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-sm); }
.cp-secret { display: block; margin-top: 6px; color: var(--text-muted); }
.cp-otp-link { display: flex; width: fit-content; margin-top: 8px; }
.cp-secret code { word-break: break-all; }
.cp-sessions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cp-session { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--radius); background: var(--surface-2); min-width: 0; }
.cp-session.is-current { background: var(--success-soft); }
.cp-session-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--surface); flex: none; color: var(--text-muted); }
.cp-session-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.cp-back { margin: 0; }

/* Raum gesperrt (2FA Pflicht) / ohne Raum */
.cp-locked { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 36px 20px; max-width: 560px; margin: 24px auto; }
.cp-locked h1 { font-size: var(--fs-xl); }
.cp-locked p { margin: 0; color: var(--text-muted); }
.cp-locked-icon { display: grid; place-items: center; width: 68px; height: 68px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); }
.cp-welcome-empty { max-width: 640px; margin: 24px auto; }

/* ================================================================== Einladung (öffentlich) */
.cp-auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
.cp-auth-brand {
  position: relative; overflow: hidden; isolation: isolate; color: var(--brand-contrast);
  background: linear-gradient(150deg, var(--brand-strong) 0%, var(--brand) 65%, color-mix(in srgb, var(--brand) 70%, var(--sage)) 100%);
  padding: calc(22px + env(safe-area-inset-top)) 20px 26px;
}
.cp-auth-brand .cp-hero-art { right: -60px; top: -40px; }
.cp-auth-brand-inner { display: flex; flex-direction: column; gap: 10px; max-width: 460px; }
.cp-auth-logo { display: inline-flex; align-self: flex-start; padding: 8px 12px; border-radius: 12px; background: #fff; margin-bottom: 8px; }
.cp-auth-logo .cp-logo-mark { border: 0; padding: 0; width: 30px; height: 30px; }
.cp-auth-logo .cp-logo-text { filter: none !important; opacity: 1 !important; }
.cp-auth-title { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.cp-auth-lead { margin: 0; opacity: .92; }
.cp-auth-benefits { list-style: none; margin: 6px 0 0; padding: 0; display: none; flex-direction: column; gap: 10px; }
.cp-auth-benefits li { display: flex; align-items: center; gap: 10px; }
.cp-auth-benefits li > span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: rgba(255, 255, 255, .14); flex: none; }
.cp-auth-main { flex: 1; display: flex; justify-content: center; padding: 0 14px 28px; }
.cp-auth-card {
  width: 100%; max-width: 440px; margin-top: -14px; display: flex; flex-direction: column; gap: 14px; padding: 22px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); position: relative;
}
.cp-auth-card-title { font-size: var(--fs-xl); font-weight: 700; letter-spacing: -.01em; overflow-wrap: anywhere; }
.cp-auth-card p { margin: 0; }
.cp-auth-note { display: flex; gap: 6px; align-items: flex-start; margin: 0; }
.cp-auth-inline { display: flex; justify-content: center; padding: 24px 0; }
.cp-auth-inline .cp-auth-card { margin-top: 0; box-shadow: var(--shadow); }
.cp-auth-note .icon { margin-top: 2px; }
@media (min-width: 900px) {
  .cp-auth { display: grid; grid-template-columns: minmax(380px, 46%) 1fr; }
  .cp-auth-brand { display: flex; align-items: center; justify-content: center; padding: 48px; }
  .cp-auth-brand .cp-hero-art { width: 520px; height: 520px; right: -120px; top: auto; bottom: -120px; }
  .cp-auth-title { font-size: 38px; }
  .cp-auth-benefits { display: flex; }
  .cp-auth-main { align-items: center; padding: 48px 32px; }
  .cp-auth-card { margin-top: 0; padding: 32px 30px; }
}

/* ================================================================== Mitarbeitende: Übersicht */
.cp-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.cp-toolbar .ad-search { flex: 1 1 220px; max-width: 360px; }
.cp-space-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 760px) { .cp-space-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .cp-space-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cp-space-card { display: flex; flex-direction: column; gap: 10px; height: 100%; padding: 16px; color: var(--text); text-decoration: none !important; transition: border-color .12s, box-shadow .12s; }
.cp-space-card:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.cp-space-card.has-unread { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.cp-space-card-head { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.cp-space-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: var(--brand-soft); color: var(--brand); flex: none; }
.cp-space-card-title { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.cp-space-card-title strong { font-size: var(--fs-lg); overflow-wrap: anywhere; }
.cp-unread-pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; background: var(--accent); color: var(--accent-contrast); font-size: var(--fs-xs); font-weight: 700; white-space: nowrap; flex: none; }
.cp-space-desc { margin: 0; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cp-space-stats { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; }
.cp-space-stats .small { display: inline-flex; align-items: center; gap: 4px; }
.cp-space-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }
.cp-avatars { display: inline-flex; align-items: center; }
.cp-avatars .avatar + .avatar { margin-left: -6px; box-shadow: 0 0 0 2px var(--surface); }

/* ================================================================== Mitarbeitende: Projektraum */
.cp-room-strip { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px; font-size: var(--fs-sm); color: var(--text-muted); }
.cp-strip-item { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cp-subtabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--border); margin: 0 -2px; padding: 0 2px; scrollbar-width: none; }
.cp-subtabs::-webkit-scrollbar { display: none; }
.cp-subtab {
  position: relative; display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 10px 12px; white-space: nowrap; flex: none;
  color: var(--text-muted); font-weight: 600; text-decoration: none !important; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.cp-subtab:hover { background: var(--surface-2); color: var(--text); }
.cp-subtab.is-active { color: var(--brand-strong); }
.cp-subtab.is-active::after { content: ''; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--brand); }
.cp-subtab-n { color: var(--text-faint); font-weight: 600; font-variant-numeric: tabular-nums; }
/* Handy: alle fünf Bereiche sichtbar (Symbol über Text) statt seitlich scrollen */
@media (max-width: 599px) {
  .cp-subtabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; overflow: visible; }
  .cp-subtab { flex-direction: column; gap: 3px; min-width: 0; padding: 8px 2px 9px; font-size: 11.5px; text-align: center; }
  .cp-subtab > span:not(.cp-tab-badge):not(.cp-subtab-n) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .cp-subtab .cp-subtab-n { display: none; }
  .cp-subtab .cp-tab-badge { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 17px; height: 17px; font-size: 10px; }
}

/* Schritte-Editor */
.cp-steps-editor { display: flex; flex-direction: column; gap: 14px; }
.cp-steps-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.cp-steps-counts { display: flex; flex-wrap: wrap; gap: 6px; }
.cp-steps-count { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 600; }
.cp-item-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cp-item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: 'kind main main' 'status status actions';
  align-items: center; gap: 8px 10px; padding: 10px 10px 10px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); transition: box-shadow .12s, border-color .12s, opacity .12s;
}
.cp-item.is-hidden { background: repeating-linear-gradient(135deg, var(--surface), var(--surface) 10px, var(--surface-2) 10px, var(--surface-2) 20px); }
.cp-item.is-drag { opacity: .45; }
.cp-item.is-over { border-color: var(--brand); box-shadow: 0 -3px 0 0 var(--brand); }
.cp-grip { grid-area: grip; color: var(--text-faint); cursor: grab; }
.cp-item-kind { grid-area: kind; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; flex: none; }
.cp-item-main { grid-area: main; display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 4px 2px; border: 0; background: none; font: inherit; color: var(--text); text-align: left; cursor: pointer; border-radius: var(--radius-sm); }
.cp-item-main:hover .cp-item-title { color: var(--brand-strong); text-decoration: underline; }
.cp-item-title { font-weight: 650; overflow-wrap: anywhere; }
.cp-item-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; font-size: var(--fs-sm); color: var(--text-muted); }
.cp-item-status { grid-area: status; min-width: 0; }
.cp-status-select { width: 100%; max-width: 240px; font-weight: 600; }
.cp-status-select.cp-status-waiting_client { border-color: color-mix(in srgb, var(--warning) 60%, var(--border-strong)); color: var(--warning); }
.cp-status-select.cp-status-done { color: var(--success); }
.cp-status-select.cp-status-in_progress { color: var(--info); }
.cp-item-actions { grid-area: actions; display: flex; align-items: center; justify-content: flex-end; gap: 0; }
/* Schmale Handys: Status in eigener Zeile – neben den vier Knöpfen bliebe für «Wartet auf Kunde» zu wenig Platz */
@media (max-width: 519px) {
  .cp-item { grid-template-areas: 'kind main main' 'status status status' 'actions actions actions'; }
  .cp-status-select { max-width: none; }
}
.cp-vis.is-off { color: var(--warning); }
@media (min-width: 900px) {
  .cp-item { grid-template-columns: auto auto minmax(0, 1fr) 190px auto; grid-template-areas: 'grip kind main status actions'; padding: 6px 6px 6px 8px; }
  .cp-status-select { width: 100%; }
}
.cp-seg-field { display: flex; flex-direction: column; gap: 6px; }
.cp-fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px 14px; margin: 0; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cp-fieldset legend { padding: 0 6px; font-size: var(--fs-sm); font-weight: 700; color: var(--text-muted); }
.cp-toggles { display: flex; flex-direction: column; gap: 10px; }
.cp-space-form .toggle { align-items: flex-start; }

/* Personen */
.cp-people-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
@media (min-width: 1100px) { .cp-people-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); } }
.cp-person-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.cp-person { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); min-width: 0; }
.cp-person:first-child { border-top: 0; }
.cp-person-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.cp-person-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 650; }
.cp-person-meta { display: flex; align-items: center; gap: 4px 8px; flex-wrap: wrap; margin-top: 2px; }
.cp-staff-add { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-top: 12px; }
.cp-staff-add .field { flex: 1 1 200px; }

/* Vorschau «Als Kunde ansehen» */
.cp-preview-modal .modal-body { background: var(--bg); padding-top: 12px; }
@media (min-width: 720px) { .cp-preview-modal.modal-lg { max-width: 1120px; } }
.cp-preview-note { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--warning-soft); color: var(--warning); font-size: var(--fs-sm); font-weight: 600; }
.cp-preview-note .icon { margin-top: 1px; }
.cp-preview-frame { min-height: 0; background: transparent; }
.cp-preview-frame .cp-col-side { position: static; }

/* ================================================================== Touch-Ziele & Handy */
@media (pointer: coarse), (max-width: 899px) {
  /* .input hat in app.css nach der Touch-Regel min-height 42px – im Modul wieder auf 44 px */
  .cp-app .input, .cp-staff-page .input, .cp-auth .input { min-height: var(--tap); }
  .cp-tab, .cp-room-opt { min-height: var(--tap); }
  .cp-chips .chip { min-height: var(--tap); }
  .cp-file-main { min-height: 64px; }
}
.cp-room-list { list-style: none; margin: 0 -8px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.cp-room-opt {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px; border: 0; border-radius: var(--radius);
  background: none; font: inherit; color: var(--text); text-align: left; cursor: pointer;
}
.cp-room-opt:hover { background: var(--surface-2); }
.cp-room-opt.is-active { background: var(--brand-soft); }
.cp-room-opt-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--surface-3); color: var(--brand); flex: none; }
.cp-room-opt-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.cp-room-opt.is-locked .cp-room-opt-icon { color: var(--warning); }
.cp-room-opt-lock { color: var(--warning); font-weight: 650; }
.cp-room-lock { color: var(--warning) !important; flex: none; }
.cp-room-opt > .icon { color: var(--brand); }

/* ================================================================== Dunkelmodus */
@media (prefers-color-scheme: dark) {
  .cp-logo-text { filter: brightness(0) invert(1); opacity: .92; }
  .cp-hero, .cp-auth-brand {
    background: linear-gradient(135deg, var(--surface-2) 0%, var(--brand-soft) 70%, color-mix(in srgb, var(--brand-soft) 70%, var(--sage-soft)) 100%);
    color: var(--text); border: 1px solid var(--border);
  }
  .cp-hero-art polygon { fill: var(--brand); opacity: .1; }
  .cp-hero-art .b { fill: var(--sage); opacity: .14; }
  .cp-hero-art .arc { stroke: var(--sage); opacity: .3; }
  .cp-progress-track { background: var(--surface-3); }
  .cp-progress-track > span { background: var(--brand); }
  .cp-auth-benefits li > span { background: var(--surface-3); color: var(--brand); }
  .cp-kpi.is-strong { background: linear-gradient(135deg, var(--surface-2), var(--brand-soft)); color: var(--text); border-color: var(--border); }
  .cp-attention.is-clear { background: linear-gradient(180deg, var(--success-soft), var(--surface) 80%); }
  .cp-msg.is-own .cp-bubble { background: color-mix(in srgb, var(--brand) 32%, var(--surface-2)); color: var(--text); }
  .cp-msg.is-own .cp-msg-edited, .cp-msg.is-own .cp-msg-time-inline { opacity: .75; }
}

@media print {
  .cp-header, .cp-tabbar, .cp-banner, .cp-composer, .cp-footer { display: none !important; }
  .cp-hero { color: #000; background: none; box-shadow: none; border: 1px solid #ccc; }
}
