/* Comms module (WP-K): inbox, conversations, calendar, rooms, documents, secure files. */

/* ---------- layout helpers ---------- */
.cm-split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; align-items: start; }
.cm-split.wide-side { grid-template-columns: minmax(0, 1fr) 360px; }
.cm-side { display: grid; gap: 14px; min-width: 0; }
.cm-tabs { margin-bottom: 0; }
.cm-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cm-bar .grow { flex: 1; }
.cm-muted { color: var(--muted); font-size: 12px; }
.cm-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: #eaf2f9; color: #2f5f88; white-space: nowrap; }
.cm-chip.green { background: var(--okBg); color: var(--okFg); } .cm-chip.amber { background: var(--warnBg); color: var(--warnFg); } .cm-chip.red { background: var(--badBg); color: var(--badFg); }
.cm-chip.purple { background: #f0ebfb; color: #4a2bb0; }
.cm-ch { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none; font-size: 13px; color: #fff; background: #2083ee; }
.cm-ch.sms { background: #7553d6; } .cm-ch.whatsapp { background: #13b985; } .cm-ch.call { background: #29b6db; } .cm-ch.chat { background: #f5a524; } .cm-ch.internal { background: #97a6b8; }
.cm-subj { display: flex; gap: 10px; align-items: center; min-width: 260px; white-space: normal; }
.cm-subj b { display: block; font-size: 13px; }
.cm-subj.unread b { color: #0a4d97; }
.cm-subj.unread b:before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #0a6fd2; margin-right: 6px; vertical-align: middle; }
.cm-due { font-weight: 700; } .cm-due.late { color: var(--badFg); } .cm-due.risk { color: var(--warnFg); }
.cm-bulk { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 8px 10px; background: #f5f8fb; border-bottom: 1px solid #e0e7ed; }
.cm-bulk select { width: auto; min-height: 30px; font-size: 12px; }

/* ---------- conversation ---------- */
.cm-thread { display: grid; gap: 12px; padding: 4px 0; }
.cm-msg { border: 1px solid #dbe4ec; border-radius: 6px; background: #fff; overflow: hidden; }
.cm-msg.in { border-left: 4px solid #2083ee; }
.cm-msg.out { border-left: 4px solid #13b985; background: #fbfefd; }
.cm-msg.internal { border-left: 4px solid #f5a524; background: #fffbea; }
.cm-msg .hd { display: flex; gap: 10px; align-items: center; padding: 8px 12px; background: #f7fafc; border-bottom: 1px solid #e6edf3; flex-wrap: wrap; }
.cm-msg.internal .hd { background: #fff5d6; }
.cm-msg .hd b { font-size: 12.5px; }
.cm-msg .hd .when { margin-left: auto; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.cm-msg .bd { padding: 10px 12px; font-size: 13px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; color: var(--text); }
.cm-msg .tr { margin: 0 12px 10px; padding: 8px 10px; border-radius: 4px; background: #eef6ff; border: 1px dashed #9cc4ee; font-size: 12.5px; white-space: pre-wrap; }
.cm-msg .ft { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 6px 12px 10px; font-size: 11.5px; color: var(--muted); }
.cm-msg .ft form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.cm-msg .ft select { min-height: 26px; font-size: 11.5px; padding: 2px 6px; border: 1px solid #b9c8d6; border-radius: 3px; }
.cm-files { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 12px 10px; }
.cm-file { display: inline-flex; gap: 6px; align-items: center; border: 1px solid #cbd7e2; border-radius: 4px; padding: 4px 8px; font-size: 12px; background: #f7fafc; }
.cm-reply { border-top: 2px solid #0a6fd2; }
.cm-reply textarea { min-height: 140px; }
.cm-customer { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.cm-avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, #2083ee, #0b2a57); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; flex: none; }
.cm-avatar.sm { width: 26px; height: 26px; font-size: 11px; }
.cm-consent { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 12px; }
.cm-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.cm-list li { padding: 7px 0; border-bottom: 1px solid #edf1f4; font-size: 12.5px; display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; }
.cm-list li:last-child { border-bottom: 0; }
.cm-list li .sub { display: block; font-size: 11.5px; color: var(--muted); }

/* ---------- calendar ---------- */
.cm-cal { display: grid; grid-template-columns: 54px repeat(var(--days, 7), minmax(0, 1fr)); border: 1px solid #d6e0e9; border-radius: 4px; background: #fff; overflow: hidden; }
.cm-cal .hd { background: #eff4f8; border-bottom: 1px solid #c8d4df; padding: 7px 6px; font-size: 12px; font-weight: 700; color: #2f4559; text-align: center; border-left: 1px solid #e0e7ed; }
.cm-cal .hd.today { background: #0a6fd2; color: #fff; }
.cm-cal .hd small { display: block; font-weight: 600; opacity: .8; }
.cm-cal .hr { font-size: 10.5px; color: var(--muted); text-align: right; padding: 2px 6px 0 0; height: 44px; border-top: 1px solid #edf1f4; }
.cm-cal .col { position: relative; border-left: 1px solid #e0e7ed; background: repeating-linear-gradient(#fff 0 43px, #edf1f4 43px 44px); }
.cm-cal .col.off { background: repeating-linear-gradient(#f7f9fb 0 43px, #e8edf2 43px 44px); }
.cm-cal .col.today { background: repeating-linear-gradient(#f4f9ff 0 43px, #e3edf7 43px 44px); }
.cm-ev { position: absolute; left: 3px; right: 3px; border-radius: 4px; padding: 3px 5px; font-size: 11px; line-height: 1.25; overflow: hidden; color: #0b2a57; background: #dceafc; border-left: 3px solid #2083ee; box-shadow: 0 1px 2px rgba(6, 26, 54, .08); }
.cm-ev a { color: inherit; font-weight: 700; display: block; }
.cm-ev.call { background: #d9f3fa; border-color: #0c8ec6; } .cm-ev.task { background: #f0ebfb; border-color: #7553d6; } .cm-ev.visit { background: #fff1d9; border-color: #e08a00; }
.cm-ev.done { opacity: .6; } .cm-ev.done a { text-decoration: line-through; }
.cm-ev small { display: block; font-weight: 600; opacity: .85; }
.cm-now { position: absolute; left: 0; right: 0; border-top: 2px solid #e8365d; z-index: 2; }
.cm-now:before { content: ""; position: absolute; left: -4px; top: -5px; width: 8px; height: 8px; border-radius: 50%; background: #e8365d; }
.cm-allday { grid-column: 1 / -1; display: grid; grid-template-columns: 54px repeat(var(--days, 7), minmax(0, 1fr)); border-bottom: 1px solid #c8d4df; background: #fafcfd; }
.cm-allday > div { padding: 3px; border-left: 1px solid #e0e7ed; display: grid; gap: 2px; min-height: 22px; }
.cm-allday .lbl { font-size: 10px; color: var(--muted); padding: 4px 6px 0 0; text-align: right; border-left: 0; }
.cm-pill { font-size: 10.5px; padding: 1px 5px; border-radius: 3px; background: #f0ebfb; color: #4a2bb0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.cm-pill.overdue { background: var(--badBg); color: var(--badFg); }
.cm-calwrap { overflow-x: auto; }
.cm-calwrap .cm-cal { min-width: 640px; }
.cm-presence { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #97a6b8; margin-right: 5px; vertical-align: middle; }
.cm-presence.available { background: #13b985; } .cm-presence.busy { background: #e8365d; } .cm-presence.dnd { background: #c01d47; } .cm-presence.away { background: #f5a524; }
.cm-hours { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; min-width: 210px; }
.cm-hours span { font-size: 10px; text-align: center; padding: 2px 0; border-radius: 2px; background: #edf1f4; color: #71849a; }
.cm-hours span.on { background: #d4f3e6; color: #04955d; font-weight: 700; }

/* ---------- rooms ---------- */
.cm-rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.cm-room { border: 1px solid #d6e0e9; border-radius: 6px; background: #fff; padding: 12px; display: grid; gap: 8px; align-content: start; }
.cm-room:hover { border-color: #7fb0e2; box-shadow: 0 4px 14px rgba(6, 26, 54, .08); }
.cm-room .top { display: flex; gap: 10px; align-items: center; }
.cm-room .ico { width: 36px; height: 36px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 16px; background: linear-gradient(135deg, #2083ee, #0962d3); flex: none; }
.cm-room .ico.account { background: linear-gradient(135deg, #13b985, #04955d); } .cm-room .ico.service { background: linear-gradient(135deg, #f5a524, #e08a00); }
.cm-room .ico.project { background: linear-gradient(135deg, #7553d6, #4a2bb0); } .cm-room .ico.partner { background: linear-gradient(135deg, #29b6db, #0c8ec6); }
.cm-room h4 { margin: 0; font-size: 14px; } .cm-room h4 a { color: var(--text); }
.cm-room .meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.cm-faces { display: flex; }
.cm-faces .cm-avatar { border: 2px solid #fff; margin-left: -6px; } .cm-faces .cm-avatar:first-child { margin-left: 0; }
.cm-posts { display: grid; gap: 10px; }
.cm-post { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; padding: 10px; border: 1px solid #e3eaf0; border-radius: 6px; background: #fff; }
.cm-post.pinned { border-color: #f0b429; box-shadow: inset 3px 0 0 #f0b429; }
.cm-post.system { grid-template-columns: 1fr; background: transparent; border: 0; padding: 2px 10px; font-size: 12px; color: var(--muted); }
.cm-post .who { font-size: 12.5px; } .cm-post .who b { margin-right: 6px; } .cm-post .who span { color: var(--muted); font-size: 11.5px; }
.cm-post .txt { font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; margin-top: 3px; }
.cm-post .txt .mention, .cm-comment .txt .mention { color: #0a4d97; font-weight: 700; background: #eaf2ff; border-radius: 3px; padding: 0 2px; }
.cm-post .acts, .cm-comment .acts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.cm-react { display: inline-flex; align-items: center; gap: 3px; border: 1px solid #d6e0e9; border-radius: 12px; padding: 1px 8px; font-size: 12px; background: #fff; cursor: pointer; min-height: 24px; }
.cm-react.on { background: #eaf2ff; border-color: #7fb0e2; }
.cm-react:focus-visible { outline: 2px solid #0a6fd2; outline-offset: 1px; }
.cm-tasks { display: grid; gap: 8px; }
.cm-task { border: 1px solid #dbe4ec; border-radius: 6px; padding: 10px 12px; background: #fff; display: grid; gap: 6px; }
.cm-task.done { opacity: .7; } .cm-task.done .t { text-decoration: line-through; }
.cm-task.blocked { border-left: 4px solid #f5a524; } .cm-task.late { border-left: 4px solid #e8365d; }
.cm-task .t { font-weight: 700; font-size: 13px; }
.cm-task .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--muted); }
.cm-check { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.cm-check li form { display: inline; margin: 0; }
.cm-check button { border: 0; background: none; padding: 0; cursor: pointer; font: 12.5px var(--fb); color: var(--text); display: inline-flex; gap: 6px; align-items: center; text-align: left; }
.cm-check button i { color: #9fb2c6; } .cm-check .ok i { color: #13b985; } .cm-check .ok span { text-decoration: line-through; color: var(--muted); }
.cm-progress { height: 6px; border-radius: 4px; background: #e6edf3; overflow: hidden; } .cm-progress i { display: block; height: 100%; background: linear-gradient(90deg, #13b985, #04955d); }
.cm-comment { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-bottom: 1px solid #edf1f4; }
.cm-comment .replies { margin-top: 8px; padding-left: 12px; border-left: 2px solid #e3eaf0; }
.cm-comment:target { background: #fffbea; }

/* ---------- documents ---------- */
.cm-editor { border: 1px solid #b9c8d6; border-radius: 4px; background: #fff; }
.cm-editor .tb { display: flex; gap: 4px; flex-wrap: wrap; padding: 6px; border-bottom: 1px solid #dbe4ec; background: #f5f8fb; }
.cm-editor .tb button { min-width: 30px; min-height: 28px; border: 1px solid #cbd7e2; border-radius: 3px; background: #fff; cursor: pointer; font: 700 12px var(--fb); color: #22517a; }
.cm-editor .ed { min-height: 360px; padding: 14px 18px; font-size: 14px; line-height: 1.6; outline: 0; overflow-wrap: anywhere; }
.cm-editor .ed:focus { box-shadow: inset 0 0 0 2px rgba(10, 111, 210, .2); }
.cm-doc { font-size: 14px; line-height: 1.6; padding: 4px 4px 10px; overflow-wrap: anywhere; }
.cm-doc h2 { font-size: 18px; margin: 14px 0 6px; } .cm-doc h3 { font-size: 15px; margin: 12px 0 4px; }
.cm-doc table { border-collapse: collapse; width: 100%; } .cm-doc td, .cm-doc th { border: 1px solid #d6e0e9; padding: 5px 8px; }
.cm-diff { font: 12.5px/1.5 var(--fb); border: 1px solid #dbe4ec; border-radius: 4px; overflow: hidden; }
.cm-diff div { padding: 3px 10px; white-space: pre-wrap; } .cm-diff .add { background: #e7f8f0; color: #04683f; } .cm-diff .add:before { content: "+ "; font-weight: 700; }
.cm-diff .del { background: #fdecef; color: #9b1c33; text-decoration: line-through; } .cm-diff .del:before { content: "− "; font-weight: 700; }

/* ---------- secure share (public page) ---------- */
.cm-share { max-width: 620px; margin: 40px auto; padding: 0 16px; }
.cm-share .card { background: #fff; border: 1px solid #d6e0e9; border-radius: 8px; box-shadow: 0 10px 30px rgba(6, 26, 54, .08); overflow: hidden; }
.cm-share .card .hd { background: linear-gradient(135deg, var(--brand-navy-2, #071d42), #123d72); color: #fff; padding: 18px 20px; }
.cm-share .card .hd h1 { margin: 6px 0 0; font-size: 20px; }
.cm-share .card .bd { padding: 18px 20px; display: grid; gap: 12px; }

@media (max-width: 1100px) {
    .cm-split, .cm-split.wide-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
    .cm-msg .hd .when { margin-left: 0; width: 100%; }
    .cm-subj { min-width: 200px; }
    .cm-editor .ed { min-height: 260px; padding: 10px; }
}
@media (prefers-reduced-motion: reduce) { .cm-room { transition: none; } }
