/* Three-panel human inbox: conversation list, customer card, messages. */
.inbox-list{width:290px;min-width:230px}.inbox-contact{order:-1;width:305px;border-left:0;border-right:1px solid #e5e7eb;background:#fcfcfd}.inbox-message-column{min-width:320px}.inbox-contact .chat-contact-card{position:static}.inbox-contact h3{margin:18px 0 8px;font-size:13px}.inbox-contact h2{font-size:18px}.inbox-dialog-head{padding:10px 14px}.chat-dialog-actions{display:flex;align-items:center;gap:6px;padding:7px 12px;border-top:1px solid #e8e8ee;flex-wrap:wrap}.chat-dialog-actions button{font-size:12px;padding:5px 8px;background:#f7f7f9;border:1px solid #e0e1e7;border-radius:7px}.chat-dialog-actions [data-inbox-state]{margin-right:auto;font-size:12px;color:#777f8e}.chat-state-badge{color:#788492;font-size:11px}.inbox-list>#chat-inbox-state{margin:0 10px 9px;width:calc(100% - 20px);font-size:12px;padding:7px}.chat-note{background:#fff6d9!important;border:1px solid #ecd38c;align-self:stretch;max-width:95%}.chat-note strong{font-size:11px;display:block;color:#8f6a12;margin-bottom:6px}.chat-bubble>div{white-space:pre-wrap;overflow-wrap:anywhere}
#chat-compose.chat-composer{display:flex;flex-direction:column;gap:8px;flex:none;padding:10px 12px;margin:0;border-top:1px solid #e5e7eb;background:white;max-height:52%;overflow-y:auto}.compose-routing{display:flex;gap:8px}.compose-routing select{min-width:0;font-size:12px;padding:7px;flex:1}.compose-hint{margin:0;font-size:11px;color:#7a8291}.note-hint{color:#886018}.chat-composer.is-note{background:#fffaec!important}.chat-composer textarea{resize:vertical;width:100%;min-height:72px;max-height:180px;border:1px solid #dfe1e9;border-radius:9px;padding:9px;font-size:14px;line-height:1.5;box-sizing:border-box}.compose-tools{display:flex;align-items:center;gap:6px;flex-wrap:wrap}.compose-tools button{padding:7px 9px;border-radius:7px;font-size:12px}.compose-tools button:not(.primary){background:#f7f7fa;border:1px solid #e1e3ea}.compose-tools [data-send]{margin-left:auto}.compose-shortcut{font-size:10px;color:#9a9eaa}.compose-file{background:#f5f6f8;border:1px solid #e4e6eb;border-radius:9px;padding:8px;display:flex;gap:8px;align-items:center;flex-wrap:wrap;font-size:12px}.compose-file span{overflow-wrap:anywhere;flex:1}.compose-file small{width:100%;color:#828897}.compose-file audio{width:100%;height:34px}.compose-file img{max-height:110px;max-width:160px;border-radius:6px}.compose-file button{font-size:11px}.chat-composer [data-compose-popup]{border:1px solid #e1e3ea;border-radius:10px;padding:10px;max-height:230px;overflow:auto;background:white}.compose-emojis{display:flex;gap:5px;flex-wrap:wrap}.compose-emojis button{font-size:21px;padding:6px;border:0;background:none}.compose-template-head{display:flex;align-items:center;gap:8px;font-size:12px}.compose-template-head strong{flex:1}.compose-template-head button{font-size:12px}.compose-template{display:flex;border-bottom:1px solid #eee;padding:5px 0}.compose-template button{background:none;border:0;text-align:left;padding:7px}.compose-template [data-use-template]{flex:1;min-width:0}.compose-template small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:420px;color:#828897}.chat-composer .error{margin:0;font-size:12px}.chat-composer [hidden],.chat-dialog-actions [hidden]{display:none!important}
@media(min-width:1450px){.inbox-list{width:310px}.inbox-contact{width:325px}}
@media(max-width:1150px){.inbox-list{width:235px;min-width:200px}.inbox-contact{width:245px}.compose-shortcut{display:none}.inbox-message-column{min-width:270px}}
@media(max-width:850px){.inbox-contact{width:205px}.inbox-list{width:190px;min-width:170px}.compose-routing{flex-direction:column}.chat-dialog-actions{gap:4px}.chat-head-agent{max-width:100%}}
@media(max-width:700px){.inbox{height:auto;min-height:80vh;overflow:visible}.inbox-list{width:100%;max-height:220px}.inbox-conversation{flex-direction:column}.inbox-contact{order:0;width:auto;border-right:0;border-top:1px solid #eee;max-height:330px}.inbox-message-column{min-width:0;min-height:520px}.chat-messages{min-height:240px;max-height:55vh}#chat-compose.chat-composer{max-height:none}.compose-routing{flex-direction:row}.inbox-dialog-head{position:static}}
.inbox #chat-compose.chat-composer{flex-wrap:nowrap;align-items:stretch;max-height:65%;overflow-x:hidden}.inbox #chat-compose.chat-composer textarea{flex:none;height:72px;min-height:60px;min-width:0}.inbox #chat-compose.chat-composer button{align-self:auto;min-height:30px;padding:6px 9px}.compose-routing{width:100%;flex-shrink:0}.compose-routing select{width:0;flex:1 1 0}.compose-tools,.compose-hint,.compose-file{flex-shrink:0}.compose-tools [data-send]{white-space:nowrap}.inbox-dialog-head .chat-head-agent .chat-agent-bar{flex-wrap:wrap}
@media(max-width:1500px){.inbox-list{width:245px;min-width:200px}.inbox-contact{width:250px}.inbox-dialog-head{grid-template-columns:minmax(0,1fr) auto;gap:6px}.chat-head-agent{grid-row:2;grid-column:1/-1;width:100%;padding-top:3px}.inbox-dialog-head #chat-info-toggle{grid-column:2;grid-row:1}.compose-shortcut{display:none}}
@media(max-width:950px) and (min-width:701px){.inbox-list{width:190px;min-width:170px}.inbox-contact{width:195px}.inbox-message-column{min-width:240px}.compose-routing{flex-direction:column}.compose-routing select{width:100%;flex:auto}}
@media(max-width:700px){.inbox-list{width:100%;min-width:0}.inbox-contact{width:auto}.inbox #chat-compose.chat-composer{max-height:none}.compose-routing select{width:0;flex:1 1 0}}
/* Calm, full-width conversation workspace. Scoped to the inbox only. */
.workspace-main>.content:has(>.inbox){max-width:none;width:100%;padding:0!important;margin:0;box-sizing:border-box;display:flex;flex-direction:column;height:calc(100dvh - 48px);overflow:hidden}
.content:has(>.inbox)>.schedule-toolbar{height:48px;min-height:48px;margin:0;padding:0 20px;border-bottom:1px solid #dfe6ec;background:white;box-sizing:border-box}
.content:has(>.inbox)>.schedule-toolbar h1{font-size:19px;letter-spacing:-.3px}.chat-sync-status{font-size:11px;color:#84919e}
.content>.inbox{height:auto;flex:1;min-height:0;border:0;border-radius:0;width:100%}
.inbox .inbox-list{width:clamp(235px,22vw,350px);min-width:210px;background:#fff;border-right-color:#dbe3eb}
.inbox .inbox-contact{width:clamp(235px,21vw,340px);box-sizing:border-box;background:#f7f9fc;border-right:1px solid #dbe3eb;padding:18px;flex-shrink:0}
.inbox .inbox-contact h3{color:#63758a;font-size:11px;font-weight:600;letter-spacing:.5px;text-transform:uppercase;border-top:1px solid #e1e7ef;padding-top:16px;margin-top:20px}
.inbox .inbox-contact h2{font-size:18px;color:#263c51}.inbox .inbox-contact p{font-size:12px;line-height:1.6}.inbox .inbox-contact select{width:100%;font-size:12px;height:34px;border:1px solid #dce3ec;border-radius:6px;padding:5px;background:white}
.inbox .inbox-contact button{border-radius:6px;font-size:12px;min-height:28px;padding:5px 8px}.inbox .inbox-contact .primary{background:#527ea3;color:white}.inbox .inbox-contact .back-link{color:#507c9e}
.inbox .inbox-filters{gap:8px;padding:14px;background:#fff;border-bottom:0}.inbox .inbox-filters input{background:#f4f6f9;border-color:#e8edf3;border-radius:7px;height:36px}.inbox .inbox-filters select,.inbox #chat-inbox-state{border-color:#e1e7ef;border-radius:6px;color:#657589;background:white;height:32px}
.inbox .chat-contact{padding:13px 14px;min-height:100px;border-bottom:1px solid #f0f3f6;transition:background .12s}.inbox .chat-contact:hover{background:#f3f7fb}.inbox .chat-contact.selected{background:#e8f2fc;box-shadow:inset 3px 0 #5795cf}.inbox .chat-contact-body strong{color:#243e55}.inbox .chat-route{color:#8392a3;font-size:10px}.inbox .chat-peer{font-size:11px}.inbox .chat-unread{background:#4c8abc}.inbox .chat-avatar{background:#e9eff5;color:#587893}
.inbox .inbox-dialog-head{display:flex;flex-wrap:wrap;padding:10px 18px;background:#fff;gap:12px;min-height:66px;box-sizing:border-box}.inbox .chat-head-client{flex:1;min-width:160px}.inbox .chat-head-client strong{font-size:14px}.inbox .chat-head-route{font-size:10px}.inbox .chat-head-agent{width:auto;max-width:50%;padding:0}.inbox .chat-agent-bar button{font-size:11px;padding:5px 8px;border-radius:6px;min-height:28px}.inbox .chat-head-agent .chat-agent-bar{gap:5px}.inbox #chat-info-toggle{margin-left:0;font-size:11px;border-radius:6px}
.inbox .chat-messages{background:#f3f6f9;padding:24px clamp(16px,3vw,54px);gap:14px}.inbox .chat-bubble{border:1px solid #e3e9ef;background:white;color:#2c3d4f;padding:12px 15px;border-radius:11px 11px 11px 3px;line-height:1.55;max-width:min(82%,760px);box-shadow:0 2px 3px #163b5503}.inbox .chat-bubble.chat-out{background:#e2f0f8;border-color:#d2e6f2;color:#23455d;border-radius:11px 11px 3px 11px}.inbox .chat-bubble small{font-size:10px;color:#8092a2;margin-top:7px}.inbox .crm-system-event{font-size:10px;color:#8797a6;text-align:center;padding:7px 12px;background:transparent;line-height:1.6}.inbox .chat-note{background:#fff8df!important;color:#75602e}
.inbox .chat-dialog-actions{justify-content:flex-end;background:#fff;padding:6px 18px;border-bottom:1px solid #edf1f5}.inbox .chat-dialog-actions button{background:transparent;color:#7a8997;border:0;font-size:11px;min-height:28px}.inbox .chat-dialog-actions button:hover{background:#edf3f8;color:#406a8b}.inbox .chat-dialog-actions [data-inbox-state]{color:#4c8d72;font-size:11px}
.inbox #chat-compose.chat-composer{padding:12px 18px 14px;gap:8px;max-height:55%;border-top:0;box-shadow:0 -3px 12px #23364903}.inbox .compose-routing select{flex:none;width:auto;max-width:65%;height:30px;background:white;border:0;color:#5783a7;font-size:12px;padding:4px 20px 4px 0}.inbox .compose-routing{justify-content:space-between;gap:4px;flex-direction:row}.inbox .compose-hint{font-size:10px;color:#8998a7;line-height:1.4}.inbox #chat-compose textarea{border:0;border-radius:4px;box-shadow:none;background:transparent;padding:6px 0;height:65px;min-height:50px;font-size:14px;outline-offset:3px}.inbox #chat-compose textarea:focus{outline:1px solid #bdd5e8}.inbox #chat-compose .compose-tools button{background:transparent;border:0;color:#788b9d;height:32px;min-height:32px;border-radius:6px;padding:6px 9px}.inbox #chat-compose .compose-tools button:hover{background:#edf3f8;color:#315b7b}.inbox #chat-compose .compose-tools button:disabled{opacity:.4}.inbox #chat-compose .compose-tools [data-send]{background:#4d8ebc;color:white;padding:6px 18px}.inbox #chat-compose .compose-tools [data-send]:hover{background:#3979a7}.compose-tools svg{width:18px;height:18px;display:block;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}.inbox .compose-shortcut{color:#a0acb8;display:inline;margin-left:auto}.inbox .compose-tools [data-send]{margin-left:0}.inbox .chat-composer.is-note{background:#fffbef!important}.inbox button:focus-visible{outline:2px solid #6fa7d2;outline-offset:2px}
@media(max-width:1250px){.inbox .inbox-list{width:235px;min-width:210px}.inbox .inbox-contact{width:230px;padding:12px}.inbox .chat-head-agent{max-width:100%;order:3;width:100%}.inbox .compose-shortcut{display:none}.inbox .compose-tools [data-send]{margin-left:auto}}
@media(max-width:960px) and (min-width:701px){.inbox .inbox-list{width:200px;min-width:170px}.inbox .inbox-contact{width:200px}.inbox .inbox-message-column{min-width:0}.inbox .compose-routing{flex-direction:column}.inbox .compose-routing select{max-width:100%;width:100%}.inbox .chat-messages{padding:14px}.inbox #chat-compose.chat-composer{padding:10px}.inbox .compose-tools{gap:2px}}
@media(max-width:700px){.workspace-main>.content:has(>.inbox){height:auto;overflow:visible}.content>.inbox{min-height:80vh;flex:auto}.inbox .inbox-list{width:100%;max-height:260px;min-width:0}.inbox .inbox-contact{width:100%;max-height:320px;order:0;border-top:1px solid #dbe3eb}.inbox .inbox-conversation{flex-direction:column}.inbox .inbox-message-column{min-height:480px}.inbox .chat-messages{padding:14px}.inbox #chat-compose.chat-composer{max-height:none}.inbox .compose-routing select{max-width:65%;width:auto}.inbox .compose-tools{gap:2px}.inbox .chat-bubble{max-width:90%}.inbox .chat-head-agent{width:100%;max-width:100%}}
/* Narrow screens use stacked panels instead of squeezing three columns. */
@media(max-width:960px){.workspace-main>.content:has(>.inbox){height:auto;overflow:visible}.content>.inbox{flex-direction:column;min-height:80vh;overflow:visible}.inbox .inbox-list{width:100%;min-width:0;height:245px;max-height:245px;border-right:0;border-bottom:1px solid #dbe3eb}.inbox .inbox-conversation{flex-direction:column}.inbox .inbox-contact{width:100%;order:0;max-height:320px;border-top:1px solid #dbe3eb;border-right:0}.inbox .inbox-message-column{min-height:520px}.inbox .chat-messages{min-height:240px;max-height:50vh}.inbox #chat-compose.chat-composer{max-height:none}.inbox .compose-routing{flex-direction:row}.inbox .compose-routing select{width:auto;max-width:65%}}

.chat-contact-card{border:1px solid #dfe6ed;border-radius:7px;background:#fff;padding:12px;margin-bottom:12px;min-width:0}.contact-identity{display:flex;align-items:center;gap:9px;margin:9px 0 12px}.contact-identity h2{margin:0!important;font-size:15px!important;overflow-wrap:anywhere}.contact-initials{width:32px;height:32px;border-radius:50%;background:#e8eff6;color:#52758b;display:grid;place-items:center;flex:none;font-weight:600}.contact-field{display:grid;grid-template-columns:70px minmax(0,1fr);gap:8px;font-size:12px;line-height:1.5;margin:5px 0;overflow-wrap:anywhere}.contact-field>span{color:#8b96a3}.contact-field .contact-primary-phone{font-size:13px;font-weight:500}.deal-contact-card .contact-channel-actions{display:flex;gap:5px;flex-wrap:wrap}.deal-contact-card .contact-action{padding:6px;min-height:30px;font-size:11px}.deal-contact-card .contact-action svg{width:15px;height:15px}.deal-contact-card{margin:0 0 12px}.deal-contact-card .contact-card-top{display:flex;justify-content:space-between;gap:8px;align-items:center}.deal-contact-card .contact-card-top small{font-size:10px;letter-spacing:.05em;color:#73869a}.deal-contact-card .contact-card-top button{font-size:11px}
dialog.cash-dialog.deal-link-dialog{width:min(700px,calc(100vw - 32px));max-width:700px;box-sizing:border-box;max-height:calc(100dvh - 32px);overflow:auto;padding:20px;border-radius:10px}.deal-link-dialog .dialog-top .cash-icon{display:none}.deal-link-dialog .dialog-top{position:absolute;right:12px;top:10px}.deal-link-dialog>h2{font-size:20px;margin:0 32px 8px 0}.deal-link-dialog>p{font-size:12px}.deal-link-search{display:flex;gap:10px;align-items:end}.deal-link-search label{flex:1;min-width:0;font-size:12px}.deal-link-search input{width:100%;box-sizing:border-box;height:36px}.deal-link-search button{height:36px;min-height:36px;white-space:nowrap}.deal-link-preview{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:14px 0}.deal-link-preview section{padding:12px;background:#f1f5f8;border-radius:7px;overflow-wrap:anywhere}.deal-link-preview h3{font-size:14px;margin:0 0 8px}.deal-link-preview p{font-size:12px;margin:4px 0}.deal-link-warning{padding:9px;background:#fff2de;border-left:3px solid #e4aa57;font-size:12px}.deal-link-confirm{display:flex;gap:8px;align-items:center;font-size:13px}.deal-link-confirm input{width:auto}.crm-order-section>button{margin:4px 4px 8px 0}@media(max-width:500px){.deal-link-search{flex-wrap:wrap}.deal-link-preview{grid-template-columns:1fr}}
.order-link-icon{display:inline-flex;align-items:center;justify-content:center;width:34px;min-width:34px;height:34px;min-height:34px;padding:7px!important;vertical-align:middle}.order-link-icon svg{flex:none;width:18px;height:18px}.unlinked-search{display:flex;gap:8px;align-items:center;margin:14px 0 8px}.unlinked-search input{flex:1;min-width:0;font-size:13px;height:36px}.unlinked-search button{height:36px;min-height:36px;padding:6px 12px}.unlinked-list{max-height:55vh;overflow:auto;border:1px solid #e0e7ed;border-radius:7px}.unlinked-order-row{display:flex;justify-content:space-between;gap:12px;width:100%;text-align:left;padding:10px 12px;border:0;border-bottom:1px solid #e6ebf0;border-radius:0;background:#fff;font-size:13px;color:#334454;cursor:pointer}.unlinked-order-row:hover,.unlinked-order-row:focus-visible{background:#eef5fb}.unlinked-order-row>span:first-child{min-width:0}.unlinked-order-row>span:last-child{text-align:right;flex:none}.unlinked-order-row strong{font-size:13px}.unlinked-order-row small{display:block;margin-top:3px;font-size:11px;color:#83909f;overflow-wrap:anywhere}.unlinked-order-row .unlinked-match{color:#37836b}.unlinked-empty{font-size:13px;padding:16px}.unlinked-orders-dialog [data-unlinked-more]{margin-top:10px}

/* Client terms stay readable for managers; only the owner gets an edit action. */
.contact-name-terms{display:flex;align-items:center;flex-wrap:wrap;gap:7px 10px;min-width:0;flex:1}
.contact-terms{display:inline-flex;align-items:center;gap:5px;max-width:100%}
.contact-terms-badge{display:inline-flex;align-items:center;border:1px solid var(--line,#e3e6ea);border-radius:999px;padding:4px 9px;font-size:11px;font-weight:600;line-height:1.3;color:var(--muted,#697586);background:var(--surface,#fff);white-space:normal}
.contact-terms[data-mode="discount"] .contact-terms-badge{color:#ae4306;background:#fff2e7;border-color:#f4d3b8}
.contact-terms[data-mode="cost"] .contact-terms-badge{color:#196a53;background:#eaf7f0;border-color:#bfe3d2}
.contact-terms-edit{display:grid;place-items:center;flex:none;width:27px;height:27px;padding:0!important;border:1px solid var(--line,#e3e6ea);border-radius:8px;background:var(--surface,#fff);color:var(--muted,#697586);cursor:pointer;font-size:16px}
.contact-terms-edit:hover{color:var(--accent,#c44c00);border-color:var(--accent,#c44c00)}
.contact-terms-edit:focus-visible{outline:2px solid var(--accent,#c44c00);outline-offset:2px}
[data-theme="dark"] .contact-terms[data-mode="discount"] .contact-terms-badge{color:#ffc398;background:#3a2b20;border-color:#6e4930}
[data-theme="dark"] .contact-terms[data-mode="cost"] .contact-terms-badge{color:#a0e4c6;background:#20372e;border-color:#38634f}
