/* Paket K – Kundenakte Teil 1: Reiter ziehen, Stammdaten, Interessen, Bedarfsanalyse-Ergänzungen, Mail-Empfänger, Aktivitäten im Verlauf */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.tab-order-note [hidden], .profile-bar [hidden], #profile-dialog [hidden], .o-field[hidden], .mail-rcpt [hidden], .ba-comp-list[hidden], .call-act-hint[hidden] { display: none !important; }

/* Reiter verschieben */
#main-nb > .nb-tabs > button { touch-action: pan-x; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
#main-nb > .nb-tabs.tabs-sorting { scroll-behavior: auto; cursor: grabbing; }
#main-nb > .nb-tabs > button.tab-dragging { position: relative; z-index: 3; background: var(--card); border-color: var(--yellow); box-shadow: 0 6px 18px rgba(0,0,0,.14); color: var(--text); cursor: grabbing; transition: none; }
.tab-order-note { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-height: 0; padding: 4px 2px 0; }
.tab-order-note .tab-order-hint { font-size: 11px; }
.tab-order-note .btn-link { padding: 0; font-size: 12px; }

/* Stammdaten */
.profile-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: -6px 0 8px; }
.profile-bar .small { min-width: 0; overflow-wrap: anywhere; }
.o-field .val .addr { overflow-wrap: anywhere; }
.profile-dialog { width: min(720px, calc(100vw - 24px)); }
.pf-form { display: grid; gap: 8px; }
.pf-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
.pf-grid.pf-addr { grid-template-columns: minmax(0, 2fr) minmax(0, 90px) minmax(0, 1.4fr); }
.pf-f { display: grid; gap: 4px; min-width: 0; }
.pf-f .f-label { margin: 0; }
.pf-form input:not([type=checkbox]) { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font: inherit; background: var(--card); color: var(--text); }
.pf-form input:focus { outline: 0; border-color: var(--yellow); }
.pf-sec { margin-top: 6px; }
.pf-check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; margin-top: 4px; }
.pf-history-box summary { cursor: pointer; font-size: 12.5px; font-weight: 600; }
.pf-history { margin: 8px 0 0; padding-left: 18px; font-size: 12.5px; display: grid; gap: 8px; }
.pf-history ul { margin: 2px 0 0; padding-left: 16px; }
.pf-history li { overflow-wrap: anywhere; }
.pf-old { color: var(--muted); text-decoration: line-through; }
.pf-new { font-weight: 600; }
@media (max-width: 600px) { .pf-grid, .pf-grid.pf-addr { grid-template-columns: 1fr; } .profile-dialog .dialog-foot { flex-wrap: wrap; } }

/* Bedarfsanalyse: eigene Einträge, Wettbewerbersuche */
.ba-own { display: inline-flex; align-items: stretch; }
.ba-own > .ba-chip { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.ba-x { border: 1px solid #ecd9a6; border-left: 0; background: var(--card); color: var(--muted); border-radius: 0 999px 999px 0; padding: 0 7px; font: inherit; font-size: 13px; line-height: 1; cursor: pointer; }
.ba-x:hover, .ba-x:focus-visible { color: var(--red); }
.ba-own > .ba-chip.ja + .ba-x { border-color: var(--ink); }
.ba-add { display: flex; gap: 6px; margin-top: 6px; }
.ba-add input { flex: 1; min-width: 0; padding: 4px 8px !important; }
.ba-add .btn { flex: none; }
.ba-comp-sel { margin-bottom: 6px; }
.ba-comp-search { position: relative; }
.ba-comp-list { margin-top: 4px; max-height: 210px; overflow-y: auto; border: 1px solid #ecd9a6; border-radius: var(--r); background: var(--card); padding: 4px; display: grid; gap: 2px; }
.ba-comp-list button { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; background: transparent; border-radius: 5px; padding: 6px 8px; font: inherit; font-size: 13px; color: var(--text); cursor: pointer; }
.ba-comp-list button small { color: var(--muted); font-size: 11px; flex: none; }
.ba-comp-list button.on, .ba-comp-list button:hover { background: var(--yellow-soft); }
.ba-comp-list p { margin: 4px 6px; }


/* Mail-Empfänger An/CC/BCC */
.composer2:not(.note) #composer-to { display: none; }
.composer2.note .mail-rcpt { display: none; }
.mail-rcpt, .rc-rows { display: grid; gap: 6px; }
.rc-row { display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: start; gap: 6px; }
.rc-lbl { font-size: 12px; font-weight: 600; color: var(--muted); padding-top: 6px; }
.rc-field { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-width: 0; border: 1px solid var(--line); border-radius: var(--r); padding: 3px 6px; background: var(--card); cursor: text; }
.rc-field:focus-within { border-color: var(--yellow); }
.rc-field input { flex: 1 1 140px; min-width: 0; border: 0; outline: 0; padding: 3px 2px; font: inherit; font-size: 13px; background: transparent; color: var(--text); }
.rc-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 1px 4px 1px 8px; font-size: 12px; }
.rc-chip.cust { background: var(--yellow-soft); border-color: #f6dfa6; }
.rc-chip > span { min-width: 0; overflow-wrap: anywhere; }
.rc-chip button { border: 0; background: none; color: var(--muted); font-size: 14px; line-height: 1; padding: 0 3px; cursor: pointer; }
.rc-chip button:hover, .rc-chip button:focus-visible { color: var(--red); }
.rc-tools { display: flex; flex-wrap: wrap; gap: 2px 12px; align-items: center; padding-left: 44px; }
.rc-tools .btn-link { padding: 0; font-size: 12px; }
.rc-subject { border: 1px solid var(--line); border-radius: var(--r); padding: 6px 10px; font: inherit; font-weight: 600; outline: 0; background: var(--card); color: var(--text); min-width: 0; }
.rc-subject:focus { border-color: var(--yellow); }
.rc-error { margin: 0; color: var(--red); font-size: 12px; }
.rc-error:empty { display: none; }
.mail-sent { font-size: 11.5px; color: var(--muted); margin-top: 6px; overflow-wrap: anywhere; }
@media (max-width: 480px) { .rc-tools { padding-left: 0; } }

/* Notizen: Erwähnungen mit Haken „Bearbeitet“ */
.mention-pick { padding: 3px 6px; border: 1px solid #f6dfa6; border-radius: 5px; background: #fffaf0; color: var(--text); font: inherit; font-size: 12px; max-width: 100%; }
.note-mentions { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.mention-check { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 2px 8px 2px 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); cursor: pointer; }
.mention-check.done { background: #f1faf4; border-color: #9fd3b2; }
.mention-check input:disabled + .mention { opacity: .8; }
.mention-check:has(input:disabled) { cursor: default; }

/* Kommunikation: Aktivitäten-Karten (Filter „Aktivitäten“) */
.msg.act-only .act-mini { display: grid; place-items: center; }
.msg.act-only .act-card { min-width: 0; flex: 1; }
.msg .dir.act-kind { background: #ececea; color: var(--text); }
.bubble.act-bubble { border: 1px solid var(--line); border-left: 3px solid var(--yellow); border-radius: var(--r); padding: 8px 10px; margin-top: 4px; background: var(--card); overflow-wrap: anywhere; }
.bubble.act-bubble .t { margin-bottom: 4px; }
.bubble.act-bubble .t small { color: var(--muted); }
.act-card-ops { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.bubble.act-bubble .activity-history { padding: 6px 0 0; border: 0; font-size: 12px; }
.call-act-hint { margin: 0 0 8px; padding: 6px 10px; border-radius: var(--r); background: var(--yellow-soft); border: 1px solid #f6dfa6; font-size: 12.5px; }
.ba-foot { flex-wrap: wrap; } .ba-foot .btn { flex: none; white-space: nowrap; }
.composer2 .row { flex-wrap: wrap; } .composer2 .row .btn { white-space: nowrap; }

/* Sparten in der Bedarfsanalyse (Interesse / kein Interesse / abgeschlossen) */
.ba-chip.abgeschlossen { background: #2e9e5b; border-color: #2e9e5b; color: #fff; }
.ba-chip.optional { border-style: dashed; border-color: #ecd9a6; color: var(--muted); background: transparent; }
.ba-sparten-sum { font-size: 12px; font-weight: 600; margin: 0 0 4px; }
@media (max-width: 520px) { .ba-add { flex-wrap: wrap; } }
/* Stammdaten-Kasten: Kopfzeile „Stammdaten“ mit Bearbeiten-Knopf (.profile-bar) + Felder (.o-groups) als ein umrandeter Block */
.sheet > .profile-bar { margin: 12px 0 0; padding: 10px 14px 8px; border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0; background: var(--card); }
.sheet > .profile-bar::before { content: "Stammdaten"; order: -1; margin-right: auto; font-weight: 600; font-size: 13px; }
.sheet > .profile-bar + .o-groups { padding: 4px 14px 12px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 8px 8px; background: var(--card); margin-bottom: 12px; min-width: 0; }
@media (max-width: 480px) { .sheet > .profile-bar { padding: 8px 12px 6px; } .sheet > .profile-bar + .o-groups { padding: 2px 12px 10px; } }
@media (min-width: 381px) and (max-width: 767px) { .sheet > .profile-bar + .o-groups .o-field { grid-template-columns: 118px minmax(0, 1fr); } }
/* Kategorien in Fotos und Dokumente als Reiter (Raster), sortierbar per Ziehen (assets/cat-tabs.js) */
.photo-filter.cat-tabs { flex-wrap: nowrap; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line); margin: 14px 0 4px; padding-top: 2px; scrollbar-width: thin; }
.photo-filter.cat-tabs .pcat-chip { flex: none; display: inline-flex; align-items: stretch; border: 1px solid transparent; border-bottom: 0; border-radius: 6px 6px 0 0; margin-bottom: -1px; touch-action: pan-x; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.photo-filter.cat-tabs .pcat-chip > button:not(.pcat-del) { border: 0; background: transparent; border-radius: 6px 6px 0 0; padding: 8px 12px; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; min-height: 38px; }
.photo-filter.cat-tabs .pcat-chip > button .n { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 6px; border-radius: 999px; background: var(--bg); font-size: 11px; font-weight: 600; opacity: 1; line-height: 18px; text-align: center; }
.photo-filter.cat-tabs .pcat-chip:has(> button.on) { background: var(--card); border-color: var(--line); box-shadow: inset 0 2px 0 var(--yellow); }
.photo-filter.cat-tabs .pcat-chip > button.on { background: transparent; color: var(--text); }
.photo-filter.cat-tabs .pcat-chip > button.on .n { background: var(--yellow); color: var(--ink); }
.photo-filter.cat-tabs .pcat-chip .pcat-del { border: 0; background: transparent; padding: 0 8px 0 0; margin: 0; color: var(--muted); }
.photo-filter.cat-tabs .pcat-new { flex: none; align-self: center; margin-left: 6px; border-radius: 999px; padding: 3px 10px; }
.photo-filter.cat-tabs .pcat-add { flex: none; align-self: center; margin-left: 6px; flex-wrap: nowrap; }
.photo-filter.cat-tabs.tabs-sorting { scroll-behavior: auto; cursor: grabbing; }
.photo-filter.cat-tabs .pcat-chip.tab-dragging { position: relative; z-index: 3; background: var(--card); border-color: var(--yellow); box-shadow: 0 6px 18px rgba(0,0,0,.14); }
.photo-filter.cat-tabs .pcat-chip.tab-dragging > button { color: var(--text); }
.cat-tabs-note { display: flex; gap: 10px; align-items: center; margin: 2px 0 12px; min-height: 22px; }
@media (max-width: 760px) { .cat-tabs-note .small { display: none; } }
/* Ebene 1 Sparten (kräftiger), Ebene 2 Unterkategorien (leichter, eingerückt unter der Sparte) */
.photo-filter.cat-tabs.sp-tabs { margin: 14px 0 0; }
.photo-filter.cat-tabs.sp-tabs .pcat-chip > button { font-size: 14px; padding: 9px 14px; color: var(--text); }
.photo-filter.cat-tabs.sp-tabs .pcat-chip:not(:has(> button.on)) > button { color: var(--muted); }
.photo-filter.cat-tabs.sub-tabs { margin: 0 0 4px; background: var(--card); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--r) var(--r); padding: 6px 8px 0; }
.photo-filter.cat-tabs.sub-tabs .pcat-chip { border-radius: 999px; margin: 0 0 6px; border: 1px solid transparent; }
.photo-filter.cat-tabs.sub-tabs .pcat-chip > button { min-height: 32px; padding: 5px 11px; font-size: 12.5px; border-radius: 999px; }
.photo-filter.cat-tabs.sub-tabs .pcat-chip:has(> button.on) { background: var(--ink); border-color: var(--ink); box-shadow: none; }
.photo-filter.cat-tabs.sub-tabs .pcat-chip > button.on { color: var(--yellow); }
.photo-filter.cat-tabs.sub-tabs .pcat-chip > button.on .n { background: var(--yellow); color: var(--ink); }
.photo-filter.cat-tabs.sub-tabs .pcat-chip.tab-dragging { background: var(--card); border-color: var(--yellow); }
.photo-filter.cat-tabs.sub-tabs .pcat-new, .photo-filter.cat-tabs.sub-tabs .pcat-add { margin-bottom: 6px; }
