.platform-status{display:flex;flex-wrap:wrap;gap:12px;align-items:center;background:#fff;border:1px solid var(--line,#e8e2e2);border-radius:12px;padding:14px 18px;margin:14px 0}.platform-status small{color:#847777}.platform-status .form-error{width:100%;margin:0}.platform-workspace{display:grid;grid-template-columns:minmax(240px,330px) minmax(0,1fr);gap:20px;align-items:start}.platform-dialogs>input{margin:12px;width:calc(100% - 24px)}.platform-chat{display:block;width:100%;background:white;text-align:left;border:0;border-bottom:1px solid #eee;padding:16px;cursor:pointer}.platform-chat.selected{background:#f6ebeb;border-left:3px solid #844646}.platform-chat>div{display:flex;gap:10px;justify-content:space-between}.platform-chat small{display:block;color:#887777;margin:6px 0}.platform-chat p{margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#756868;font-size:13px}.platform-empty{padding:18px}.platform-thread{padding-bottom:18px;min-width:0}.platform-thread>.muted,#platform-conversation>.muted{padding:24px}.platform-messages{display:flex;flex-direction:column;gap:14px;padding:24px;background:#faf7f7;max-height:520px;min-height:260px;overflow:auto}.platform-bubble{align-self:flex-start;background:#fff;border:1px solid #eee;border-radius:14px 14px 14px 3px;padding:12px 16px;max-width:85%;word-break:break-word}.platform-bubble.mine{align-self:flex-end;background:#f0dede;border-color:#e7caca;border-radius:14px 14px 3px 14px}.platform-bubble p{white-space:pre-wrap;margin:0 0 8px}.platform-bubble small{display:block;margin-top:6px;color:#837575;font-size:11px}.platform-bubble a{display:block;margin:6px 0}.platform-thread .section-actions,#platform-send-form{margin:16px 20px}.platform-thread h3{margin-bottom:4px}#platform-send-form textarea{width:100%;resize:vertical}@media(max-width:850px){.platform-workspace{grid-template-columns:1fr}.platform-dialogs{max-height:340px;overflow:auto}}

/* Keep the conversation readable even on short desktop screens. These selectors
   override older workspace rules without relying on stylesheet loading order. */
#platform-workspace{height:max(650px,calc(100dvh - 250px));min-height:650px;align-items:stretch;gap:20px}
#platform-workspace>.platform-dialogs{display:flex;flex-direction:column;min-height:0;overflow:hidden}
#platform-workspace>.platform-dialogs>#platform-chats{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain}
#platform-workspace>.platform-dialogs>.panel-head,#platform-workspace>.platform-dialogs>input,#platform-workspace>.platform-dialogs>.section-actions{flex:none}
#platform-workspace>.platform-thread{padding:0;min-height:0;overflow:hidden}
#platform-workspace>.platform-thread>#platform-conversation{height:100%;display:flex;flex-direction:column;min-height:0}
#platform-workspace #platform-conversation>.panel-head{padding:14px 18px;gap:12px;flex:none}
#platform-workspace #platform-conversation>.panel-head .section-actions{margin:0;padding:0;gap:10px}
#platform-workspace #platform-conversation>.platform-link-box{flex:none;padding:8px 18px}
#platform-workspace .platform-link-box>details{margin:0;max-height:300px;overflow:auto}
#platform-workspace:has(.platform-link-box details[open]){height:max(880px,calc(100dvh - 250px));min-height:880px}
#platform-workspace .platform-link-box summary{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:9px 12px}
#platform-workspace .platform-link-box summary .btn{flex:none;font-size:13px;padding:6px 10px}
#platform-workspace #platform-conversation>.platform-messages{flex:1;min-height:300px;max-height:none;padding:16px 18px;gap:10px;overflow:auto;overscroll-behavior:contain}
#platform-workspace .platform-bubble{padding:10px 14px;flex:none;max-width:85%}
#platform-workspace #platform-conversation>.section-actions{flex:none;margin:8px 18px;gap:10px}
#platform-workspace #platform-send-form{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:end;column-gap:12px;margin:8px 18px 14px;flex:none}
#platform-workspace #platform-send-form .field{margin:0;min-width:0}
#platform-workspace #platform-send-form textarea{min-height:58px;height:64px;max-height:110px;resize:vertical}
#platform-workspace #platform-send-form .form-error{grid-column:1/-1;grid-row:2;margin:0}
#platform-workspace #platform-send-form .form-footer{margin:0;padding:0 0 7px;grid-column:2;grid-row:1}
.platform-create-client-form .form-grid{grid-template-columns:1fr 1fr;gap:18px}.platform-create-client-form .form-error{white-space:pre-line}.platform-create-client-form .existing-platform-client{margin:14px 0;padding:12px 14px;background:#faf3f3;border:1px solid var(--line);border-radius:10px}.platform-create-client-form .existing-platform-client .btn{margin-top:10px}
.platform-navigation{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px 18px;margin:12px 0 16px}.platform-navigation>.platform-tabs{margin:0;flex:none}.platform-navigation>.platform-status{margin:0;padding:0;background:transparent;border:0;gap:8px;justify-content:end}.platform-navigation>.platform-status small{font-size:11px}.content:has(#platform-workspace)>.page-head{margin-bottom:16px}
@media(max-width:850px){#platform-workspace{height:auto;min-height:0;grid-template-columns:1fr}#platform-workspace>.platform-dialogs{height:300px;max-height:300px}#platform-workspace>.platform-thread{height:680px;min-height:680px}.platform-create-client-form .form-grid{grid-template-columns:1fr}}
@media(max-width:540px){#platform-workspace #platform-send-form{grid-template-columns:1fr}#platform-workspace #platform-send-form .form-footer{grid-row:3;grid-column:1;padding-top:6px}#platform-workspace .platform-link-box summary{flex-wrap:wrap}}

#platform-workspace #platform-send-form .form-footer{flex-wrap:wrap;gap:10px;max-width:190px}
#reply-templates-dialog{width:min(760px,calc(100% - 30px));max-height:90dvh}
#reply-templates-dialog .dialog-header{gap:18px}
#reply-templates-dialog .dialog-header h2{font-size:23px}
.reply-template-toolbar{display:flex;align-items:end;gap:16px;margin:18px 0}
.reply-template-toolbar .field{flex:1;min-width:0;margin:0}
.reply-template-toolbar>.btn{margin-bottom:1px;flex:none}
.reply-template-card{padding:18px;border:1px solid var(--line);border-radius:12px;margin:14px 0;background:#fffafa}
.reply-template-heading{display:flex;align-items:baseline;justify-content:space-between;gap:16px;flex-wrap:wrap}
.reply-template-heading h3{margin:0;font-size:17px;overflow-wrap:anywhere}
.reply-template-heading small{color:var(--muted);font-size:12px}
.reply-template-card p{white-space:pre-wrap;overflow-wrap:anywhere;margin:12px 0 16px;font-size:14px;line-height:1.55}
.reply-template-actions{display:flex;flex-wrap:wrap;gap:10px;align-items:center}
#reply-template-form{padding:18px;border:1px solid #dbc0c0;border-radius:12px;background:#f9f1f1;margin:18px 0}
#reply-template-form>.field{margin:14px 0}
#reply-template-form textarea{width:100%;resize:vertical;min-height:130px}
#reply-template-error:empty{display:none}
@media(max-width:540px){.reply-template-toolbar{align-items:stretch;flex-direction:column;gap:12px}#platform-workspace #platform-send-form .form-footer{max-width:none}#reply-templates-dialog .dialog-header h2{font-size:20px}.reply-template-card,#reply-template-form{padding:14px}}
