/* Stage 6: Lovable chat layout, backed by the existing ERP conversation engine. */
.chat-workspace{--chat-border:#dce4de;--chat-muted:#68766c;--chat-ink:#263c31;--chat-green:#274a40;max-width:1500px;min-width:0;margin:0 auto;color:var(--chat-ink)}
.chat-workspace .chat-heading{align-items:flex-end;flex-wrap:wrap;margin-bottom:20px;gap:14px}.chat-eyebrow{font-size:11px;font-weight:700;letter-spacing:.13em;color:var(--chat-muted);margin:0 0 5px}.chat-workspace h1{font-size:28px;line-height:1.2;font-weight:650}.chat-workspace #chat-summary{margin:7px 0 0;font-size:13px;color:var(--chat-muted)}.chat-heading-actions{display:flex;align-items:center;gap:8px}.chat-workspace .chat-privacy{font-size:12px;color:var(--chat-muted);margin-bottom:16px}
.chat-workspace .chat-layout{grid-template-columns:320px minmax(0,1fr);height:680px;min-height:520px;border:1px solid var(--chat-border);border-radius:10px;box-shadow:none;background:#fff}.chat-workspace .chat-layout>aside{display:flex;flex-direction:column;min-height:0;overflow:hidden;background:#fff;border-color:var(--chat-border)}.chat-workspace .chat-start{flex:none;gap:12px;padding:16px;border-color:var(--chat-border)}.chat-workspace .control{border-color:var(--chat-border);border-radius:6px}.chat-workspace #chat-search{min-width:0;width:100%;font-size:14px}.chat-filters{display:flex;flex-wrap:wrap;gap:3px}.chat-filters button{border:0;border-radius:5px;padding:8px 9px;background:transparent;color:var(--chat-muted);font:inherit;font-size:12px;cursor:pointer;min-height:36px}.chat-filters button[aria-pressed=true]{background:var(--chat-green);color:white}.chat-filters button:hover:not([aria-pressed=true]){background:#f0f3ef}.chat-order-picker summary{font-size:12px;color:var(--chat-green);cursor:pointer;padding:4px 0}.chat-order-picker select{margin-top:8px}.chat-workspace .chat-inspect{font-size:11px;color:var(--chat-muted);gap:6px}.chat-workspace .chat-inspect input{accent-color:var(--chat-green)}
.chat-workspace .chat-room-list{flex:1;min-height:0;overflow-y:auto;padding:0;overscroll-behavior:contain}.chat-workspace .chat-room{border:0;border-bottom:1px solid var(--chat-border);border-radius:0;margin:0;padding:16px;min-height:104px;align-items:flex-start;color:var(--chat-ink)}.chat-workspace .chat-room:hover,.chat-workspace .chat-room.selected{background:#f0f3ed}.chat-workspace .chat-room-label{width:100%;gap:7px}.chat-room-title{display:flex;gap:10px;align-items:flex-start}.chat-workspace .chat-room-label strong{font-weight:650;font-size:14px;white-space:normal;overflow-wrap:anywhere}.chat-workspace .chat-room-label small{font-size:11px;white-space:normal;overflow-wrap:anywhere;line-height:1.5;color:var(--chat-muted)}.chat-room-preview{font-size:13px;line-height:1.55;color:var(--chat-muted);overflow-wrap:anywhere;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.chat-workspace .chat-unread{background:var(--chat-green);line-height:20px;min-width:20px}.chat-list-empty{padding:24px 16px;font-size:13px;line-height:1.7;color:#68766c}.chat-list-empty p{margin:0 0 8px}
.chat-workspace .chat-thread-header{padding:18px 20px;border-color:var(--chat-border)}.chat-workspace .chat-thread-header h2{font-size:16px;font-weight:650}.chat-workspace .chat-thread-header>span,.chat-workspace .chat-connection{color:var(--chat-muted);font-size:12px}.chat-workspace .chat-messages{padding:20px;gap:16px}.chat-workspace .chat-empty{color:var(--chat-muted);font-size:14px}.chat-workspace .chat-message{max-width:85%;border-radius:8px;border-color:var(--chat-border);background:#fafbf8;padding:12px 14px}.chat-workspace .chat-message.mine{background:#edf2e9;border-color:#d7e0d1}.chat-workspace .chat-message-meta strong{color:var(--chat-ink);font-size:12px}.chat-workspace .chat-message-meta time,.chat-workspace .chat-edited{color:var(--chat-muted);font-size:11px}.chat-workspace .chat-message-text{font-size:14px;line-height:1.65}.chat-workspace .chat-message-actions .link-button{font-size:12px;color:var(--chat-green)}.chat-workspace .chat-file{border-color:var(--chat-border);color:var(--chat-green);font-size:13px}.chat-workspace .chat-compose{padding:16px 20px;border-color:var(--chat-border)}.chat-workspace .chat-compose textarea{font-size:14px;min-height:76px}.chat-workspace .chat-compose-actions{gap:8px}.chat-workspace .chat-compose-actions small{font-size:10px}.chat-workspace .chat-readonly,.chat-workspace .chat-order-context{border-color:var(--chat-border);background:#f7f9f5;color:var(--chat-muted)}.chat-workspace .chat-order-context .chat-topics{background:#f7f9f5}.chat-workspace .chat-jump{background:#edf2e9;color:var(--chat-green)}.chat-unread-divider{align-self:stretch;text-align:center;font-size:11px;color:#687b67;border-top:1px solid #dce4de;padding-top:10px;margin:8px 0;flex:none}
#chat-new-dialog{inset:0;margin:auto;height:fit-content;width:calc(100vw - 32px);max-width:510px;max-height:90dvh;padding:24px;border:1px solid #dce4de;border-radius:12px;color:#263c31;overflow:auto;background:#fff}#chat-new-dialog::backdrop{background:rgb(23 38 30 / .36)}#chat-new-form{display:flex;flex-direction:column;gap:16px;min-width:0}#chat-new-form header h2{font-size:20px;line-height:1.3;margin:0 0 7px}#chat-new-form header p{font-size:13px;color:#68766c;line-height:1.6;margin:0}#chat-new-form .control{width:100%;min-width:0;border-color:#dce4de;font-size:14px}#chat-new-form footer{display:flex;justify-content:flex-end;gap:8px}#chat-new-form .danger-text{margin:0;font-size:13px;overflow-wrap:anywhere}.chat-peers{display:grid;gap:6px;max-height:290px;overflow:auto}.chat-peer{display:flex;gap:10px;align-items:center;border:1px solid #dce4de;border-radius:6px;padding:12px;cursor:pointer}.chat-peer.selected{border-color:#274a40;background:#f0f3ed}.chat-peer input{accent-color:#274a40;flex:none}.chat-peer>span{display:grid;gap:4px;min-width:0;overflow-wrap:anywhere}.chat-peer strong{font-size:14px;font-weight:600}.chat-peer small{font-size:12px;color:#68766c}.chat-peer:focus-within,.chat-filters button:focus-visible{outline:2px solid #547c60;outline-offset:2px}
@media(max-width:1100px) and (min-width:641px){.chat-workspace .chat-layout{grid-template-columns:280px minmax(0,1fr)}.chat-workspace .chat-compose-actions{flex-wrap:wrap}.chat-workspace .chat-message{max-width:96%}}
@media(max-width:640px){.chat-workspace .chat-heading{margin-bottom:16px;align-items:center}.chat-workspace h1{font-size:24px}.chat-workspace .chat-privacy{font-size:11px}.chat-workspace .chat-layout{display:flex;flex-direction:column;height:auto;min-height:0}.chat-workspace .chat-layout>aside{overflow:visible;max-height:none;border-right:0;min-height:320px}.chat-workspace .chat-room-list{max-height:65dvh;flex:auto}.chat-workspace .chat-layout:not(.is-thread)>.chat-thread{display:none}.chat-workspace .chat-layout.is-thread>.chat-thread{display:flex;position:fixed;left:0;right:0;top:var(--viewport-top,0px);height:var(--viewport-height,100dvh);max-height:none;min-height:0;z-index:35}.chat-workspace .chat-thread-header{padding:12px}.chat-workspace .chat-messages{padding:12px}.chat-workspace .chat-message{max-width:96%}.chat-workspace .chat-compose{padding:12px}.chat-workspace .chat-compose textarea,#chat-peer-search,.chat-workspace #chat-search{font-size:16px}.chat-filters button{min-height:44px;padding:8px}.chat-workspace .chat-compose-actions{flex-wrap:wrap}.chat-workspace .chat-compose-actions small{display:none}.chat-workspace .chat-compose-actions .button{min-height:44px}.chat-workspace .chat-thread-header h2{font-size:15px}.chat-workspace .chat-thread-header .chat-back{font-size:12px}#chat-new-dialog{width:calc(100vw - 24px);padding:18px}.chat-peer{min-height:54px}}

/* Pinned b0ad communications composition; message transport/ACL/cursors unchanged. */
.chat-workspace{--chat-border:var(--lv-border);--chat-muted:var(--lv-muted-foreground);--chat-ink:var(--lv-foreground);--chat-green:var(--lv-primary)}
.chat-workspace .chat-heading h1{font-size:24px;line-height:32px;font-weight:600;letter-spacing:0}.chat-workspace .chat-heading{margin-bottom:20px}.chat-workspace #chat-summary{margin-top:4px;font-size:14px;line-height:20px}.chat-workspace .chat-layout{border-radius:8px;grid-template-columns:280px minmax(0,1fr);height:680px;min-height:0}.chat-workspace .chat-room{min-height:96px}.chat-workspace .chat-room-label strong{font-weight:600}.chat-workspace .chat-thread-header{padding:16px}.chat-workspace .chat-thread-header h2{font-weight:600}.chat-workspace .chat-messages{padding:16px;gap:20px;background:white}.chat-workspace .chat-message,.chat-workspace .chat-message.mine{border:0;background:transparent;border-radius:0;padding:0;max-width:100%}.chat-workspace .chat-message.mine{max-width:88%;margin-left:auto}.chat-workspace .chat-message-text{font-size:14px;line-height:22.75px;margin-top:8px;overflow-wrap:anywhere}.chat-workspace .chat-message.mine .chat-message-text{background:var(--lv-primary);color:oklch(.975 .008 95);border-radius:6px;padding:12px}.chat-workspace .chat-compose{padding:16px}.chat-workspace .chat-file{padding:8px;font-size:12px}.chat-workspace .chat-message-meta{gap:8px;flex-wrap:wrap}.chat-workspace .chat-message-meta strong{font-weight:600}
@media(min-width:1280px){.chat-workspace .chat-layout{grid-template-columns:320px minmax(0,1fr)}}
@media(min-width:768px){.chat-workspace .chat-layout{display:grid}.chat-workspace .chat-layout>aside{display:flex;max-height:none;overflow:hidden}.chat-workspace .chat-layout>.chat-thread,.chat-workspace .chat-layout.is-thread>.chat-thread{display:flex;position:relative;inset:auto;height:100%;max-height:680px;padding:0;z-index:auto}.chat-workspace .chat-back{display:none}.chat-workspace .chat-room-list{max-height:none}}
@media(max-width:767px){body.mobile-chat-open{overflow:auto}.chat-workspace .chat-layout{display:block;height:auto;min-height:0}.chat-workspace .chat-layout>aside{display:flex;min-height:0;border-right:0}.chat-workspace .chat-layout.is-thread>aside{display:none}.chat-workspace .chat-room-list{max-height:520px}.chat-workspace .chat-layout.is-thread>.chat-thread{display:flex;position:static;inset:auto;height:auto;max-height:none;min-height:0;padding:0;z-index:auto}.chat-workspace .chat-layout:not(.is-thread)>.chat-thread{display:none}.chat-workspace .chat-messages{min-height:176px;max-height:52dvh;padding:16px}.chat-workspace .chat-message.mine{max-width:100%}.chat-workspace .chat-compose{padding:12px}.chat-workspace .chat-back{display:inline-flex}.chat-workspace .chat-thread-header{padding:12px}.chat-workspace .chat-thread-header h2{font-size:16px}}
