/* LDHNET chat module: layout only, using the Modular Workspace palette and tokens. */
.ldh-chat-page [hidden]{display:none!important}
.ldh-chat-page{max-width:1440px;margin:0 auto}.ldh-chat-page-head{display:flex;align-items:end;justify-content:space-between;gap:1rem}.ldh-chat-page-head h1{margin:.25rem 0;font-size:clamp(1.5rem,2vw,1.875rem)}.ldh-chat-page-head p{margin:0;color:var(--ldh-muted)}
.ldh-chat-layout{display:grid;grid-template-columns:minmax(270px,340px) minmax(0,1fr);gap:1rem;min-height:min(720px,calc(100dvh - 190px));margin-top:1rem}.ldh-chat-layout>.ldh-panel{min-width:0;margin:0;padding:0;overflow:hidden}
.ldh-chat-sidebar{display:flex;flex-direction:column}.ldh-chat-side-head,.ldh-chat-thread-head{display:flex;align-items:center;gap:.75rem;padding:.9rem 1rem;border-bottom:1px solid var(--ldh-line-soft);min-height:64px}.ldh-chat-side-head{justify-content:space-between}.ldh-chat-side-head h2{margin:0;font-size:1rem}.ldh-chat-side-head h2 span{font-size:.72rem;color:var(--ldh-green-800)}.ldh-chat-side-actions{display:flex;gap:.35rem}.ldh-chat-side-actions button,.ldh-chat-icon-button,.ldh-chat-back,.ldh-chat-dialog-close{display:grid;place-items:center;flex:none;width:38px;height:38px;border:1px solid var(--ldh-line);border-radius:var(--ldh-radius);background:var(--ldh-surface);color:var(--ldh-green-900);cursor:pointer}.ldh-chat-side-actions button:hover,.ldh-chat-icon-button:hover,.ldh-chat-back:hover{background:var(--ldh-green-100);border-color:var(--ldh-green-700)}
.ldh-chat-search-label{display:block;margin:.75rem .85rem .3rem;font-size:.72rem;font-weight:700;color:var(--ldh-muted)}.ldh-chat-search-wrap{display:flex;align-items:center;gap:.5rem;margin:0 .85rem .75rem;padding:0 .65rem;border:1px solid var(--ldh-line);border-radius:var(--ldh-radius);background:var(--ldh-surface-soft);color:var(--ldh-muted)}.ldh-chat-search-wrap input{width:100%;min-height:40px;border:0;outline:0;background:transparent;color:var(--ldh-ink);font-size:.85rem}
.ldh-chat-conversations,.ldh-chat-search-results{overflow:auto;max-height:calc(100dvh - 300px);min-height:160px}.ldh-chat-conversation{width:100%;display:flex;align-items:center;gap:.7rem;padding:.7rem .85rem;text-align:left;border:0;border-top:1px solid var(--ldh-line-soft);background:var(--ldh-surface);color:var(--ldh-ink);cursor:pointer}.ldh-chat-conversation:hover,.ldh-chat-conversation[aria-current=true]{background:var(--ldh-green-100)}.ldh-chat-conversation img,.ldh-chat-thread-head img,.ldh-chat-message-avatar,.ldh-chat-person img{width:42px;height:42px;flex:none;object-fit:cover;border-radius:50%;background:var(--ldh-green-100)}.ldh-chat-conversation-copy{min-width:0;flex:1}.ldh-chat-conversation-line{display:flex;align-items:baseline;gap:.3rem;justify-content:space-between}.ldh-chat-conversation-line strong,.ldh-chat-conversation-preview{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ldh-chat-conversation-line strong{font-size:.83rem}.ldh-chat-conversation-line time,.ldh-chat-conversation-preview{font-size:.7rem;color:var(--ldh-muted)}.ldh-chat-conversation-preview{margin-top:.2rem}.ldh-chat-unread{display:grid;place-items:center;min-width:21px;height:21px;padding:0 .3rem;border-radius:999px;background:var(--ldh-green-700);color:white;font-size:.68rem;font-weight:800}
.ldh-chat-thread{display:flex;flex-direction:column;min-height:0}.ldh-chat-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.65rem;min-height:500px;padding:1.5rem;text-align:center}.ldh-chat-empty>.fas{font-size:2rem;color:var(--ldh-green-700)}.ldh-chat-empty h2{margin:.35rem 0 0;font-size:1.2rem}.ldh-chat-empty p{max-width:280px;margin:0;color:var(--ldh-muted)}.ldh-chat-primary,.ldh-chat-send{border:1px solid var(--ldh-green-700);border-radius:var(--ldh-radius);background:var(--ldh-green-700);color:white;font-weight:700;cursor:pointer}.ldh-chat-primary{min-height:42px;padding:.55rem 1rem}.ldh-chat-primary:hover,.ldh-chat-send:hover{background:var(--ldh-green-800)}.ldh-chat-secondary{min-height:40px;padding:.5rem .75rem;border:1px solid var(--ldh-line);border-radius:var(--ldh-radius);background:var(--ldh-surface);color:var(--ldh-green-800);font-size:.76rem;font-weight:700;cursor:pointer}
.ldh-chat-active{display:flex;flex-direction:column;height:min(720px,calc(100dvh - 190px));min-height:500px}.ldh-chat-thread-head img{width:40px;height:40px}.ldh-chat-thread-identity{min-width:0;flex:1}.ldh-chat-thread-identity h2{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin:0;font-size:.95rem}.ldh-chat-thread-identity span{display:block;color:var(--ldh-muted);font-size:.7rem}.ldh-chat-back{display:none}.ldh-chat-details{padding:.75rem 1rem;border-bottom:1px solid var(--ldh-line-soft);background:var(--ldh-surface-soft)}.ldh-chat-member{display:flex;align-items:center;gap:.5rem;padding:.3rem 0;font-size:.78rem}.ldh-chat-member img{width:28px;height:28px;border-radius:50%;object-fit:cover}.ldh-chat-member button{margin-left:auto}.ldh-chat-detail-actions{display:flex;flex-wrap:wrap;gap:.4rem;margin-top:.55rem}.ldh-chat-detail-actions button,.ldh-chat-member button{padding:.4rem .6rem;border:1px solid var(--ldh-line);border-radius:var(--ldh-radius);background:var(--ldh-surface);color:var(--ldh-green-800);font-size:.72rem;cursor:pointer}.ldh-chat-detail-actions button:hover,.ldh-chat-member button:hover{background:var(--ldh-green-100)}
.ldh-chat-messages{display:flex;flex:1;flex-direction:column;gap:.7rem;overflow:auto;padding:1.2rem;background:var(--ldh-surface-soft)}.ldh-chat-message{display:flex;align-items:end;gap:.45rem;max-width:min(82%,620px)}.ldh-chat-message.is-own{align-self:flex-end;flex-direction:row-reverse}.ldh-chat-message-avatar{width:27px;height:27px}.ldh-chat-message-bubble{min-width:0;padding:.6rem .75rem;border:1px solid var(--ldh-line);border-radius:var(--ldh-radius);background:var(--ldh-surface);box-shadow:var(--ldh-shadow-sm)}.ldh-chat-message.is-own .ldh-chat-message-bubble{background:var(--ldh-green-100);border-color:var(--ldh-green-200)}.ldh-chat-message-author{margin-bottom:.2rem;color:var(--ldh-green-800);font-size:.7rem;font-weight:700}.ldh-chat-message-body{white-space:pre-wrap;overflow-wrap:anywhere;font-size:.82rem;line-height:1.45}.ldh-chat-message-meta{display:flex;gap:.3rem;justify-content:flex-end;margin-top:.3rem;color:var(--ldh-muted);font-size:.62rem}.ldh-chat-message-bubble img{display:block;max-width:100%;max-height:340px;width:auto;height:auto;margin:.3rem 0;border-radius:var(--ldh-radius)}.ldh-chat-message-bubble video{display:block;max-width:100%;max-height:340px;margin:.3rem 0}.ldh-chat-message-bubble audio{display:block;max-width:100%;margin:.3rem 0}.ldh-chat-load-older{align-self:center;border:1px solid var(--ldh-line);border-radius:var(--ldh-radius);background:var(--ldh-surface);padding:.45rem .75rem;color:var(--ldh-green-800)}
.ldh-chat-composer{padding:.7rem 1rem;border-top:1px solid var(--ldh-line-soft);background:var(--ldh-surface)}.ldh-chat-compose-row{display:flex;align-items:end;gap:.5rem}.ldh-chat-compose-row textarea{flex:1;min-width:0;max-height:120px;min-height:42px;resize:vertical;padding:.65rem;border:1px solid var(--ldh-line);border-radius:var(--ldh-radius);background:var(--ldh-surface-soft);color:var(--ldh-ink);font-size:.83rem}.ldh-chat-attach{display:grid;place-items:center;flex:none;width:40px;height:42px;border:1px solid var(--ldh-line);border-radius:var(--ldh-radius);cursor:pointer;color:var(--ldh-green-800)}.ldh-chat-send{display:grid;place-items:center;flex:none;width:42px;height:42px}.ldh-chat-compose-options{display:flex;justify-content:space-between;align-items:center;gap:.5rem;margin-top:.45rem;color:var(--ldh-muted);font-size:.72rem}.ldh-chat-compose-options label{display:flex;align-items:center;gap:.35rem}.ldh-chat-compose-options input{accent-color:var(--ldh-green-700)}#ldh-chat-attachment-preview{margin-bottom:.45rem;color:var(--ldh-green-800);font-size:.75rem}#ldh-chat-record.is-recording{background:#fff0ef;color:#a73530;border-color:#eec6c1}
.ldh-chat-dialog{width:min(440px,calc(100vw - 2rem));max-height:80dvh;padding:1.25rem;border:1px solid var(--ldh-line);border-radius:var(--ldh-radius);background:var(--ldh-surface);color:var(--ldh-ink);box-shadow:var(--ldh-shadow-md)}.ldh-chat-dialog::backdrop{background:rgba(25,45,35,.45)}.ldh-chat-dialog>form{float:right}.ldh-chat-dialog h2{margin:0 0 1rem;font-size:1.05rem}.ldh-chat-dialog input[type=text],.ldh-chat-dialog input[type=search]{width:100%;min-height:42px;padding:.5rem;border:1px solid var(--ldh-line);border-radius:var(--ldh-radius)}.ldh-chat-person-list{max-height:44dvh;overflow:auto;margin:.75rem 0}.ldh-chat-person{display:flex;align-items:center;gap:.6rem;width:100%;padding:.55rem .3rem;border:0;border-bottom:1px solid var(--ldh-line-soft);background:transparent;color:var(--ldh-ink);text-align:left;cursor:pointer}.ldh-chat-person img{width:32px;height:32px}.ldh-chat-person:hover{background:var(--ldh-green-100)}.ldh-chat-person input{margin-left:auto;accent-color:var(--ldh-green-700)}.ldh-chat-toast{position:fixed;right:1rem;bottom:1rem;z-index:2000;padding:.65rem .9rem;border:1px solid var(--ldh-line);border-radius:var(--ldh-radius);background:var(--ldh-surface);box-shadow:var(--ldh-shadow-md);color:var(--ldh-ink)}
.ldh-topbar-chat{position:relative;display:grid;place-items:center;min-width:40px;height:40px;border:1px solid var(--ldh-line);border-radius:var(--ldh-radius);background:var(--ldh-surface);color:var(--ldh-green-900)}.ldh-topbar-chat:hover{background:var(--ldh-green-100);color:var(--ldh-green-900)}.ldh-topbar-chat .ldh-chat-header-count{position:absolute;top:-6px;right:-6px;display:grid;place-items:center;min-width:19px;height:19px;padding:0 .2rem;border-radius:999px;background:var(--ldh-green-700);color:#fff;font-size:.62rem;font-weight:800}.ldh-topbar-chat .ldh-chat-header-count[hidden]{display:none}
.ldh-chat-page :is(button,input,textarea,a):focus-visible,.ldh-topbar-chat:focus-visible{outline:2px solid var(--ldh-focus);outline-offset:2px}
@media(max-width:767.98px){.ldh-chat-page-head{align-items:start}.ldh-chat-page-head p{font-size:.75rem}.ldh-chat-page-head .ldh-chat-secondary{max-width:115px;min-height:44px}.ldh-chat-layout{display:block;min-height:calc(100dvh - 175px);margin-top:.7rem}.ldh-chat-layout>.ldh-panel{border-radius:var(--ldh-radius)}.ldh-chat-sidebar{min-height:calc(100dvh - 185px)}.ldh-chat-conversations,.ldh-chat-search-results{max-height:none}.ldh-chat-thread{display:none!important}.ldh-chat-page.is-thread-open .ldh-chat-sidebar{display:none}.ldh-chat-page.is-thread-open .ldh-chat-thread{display:flex!important}.ldh-chat-active{height:calc(100dvh - 175px);min-height:420px}.ldh-chat-back{display:grid}.ldh-chat-messages{padding:.75rem}.ldh-chat-message{max-width:90%}.ldh-chat-compose-row{gap:.3rem}.ldh-chat-composer{padding:.6rem}.ldh-chat-compose-options{font-size:.67rem}}

/* One aligned composer row; the SMS option is an accessible switch. */
.ldh-chat-compose-row{align-items:center;gap:.5rem}
.ldh-chat-compose-row textarea{height:44px;min-height:44px;max-height:120px;line-height:1.4;resize:none;overflow-y:auto}
.ldh-chat-compose-row .ldh-chat-attach,.ldh-chat-compose-row .ldh-chat-icon-button,.ldh-chat-compose-row .ldh-chat-send{width:44px;height:44px;min-width:44px;min-height:44px;margin:0;align-self:center}
.ldh-chat-compose-options{margin-top:.65rem;min-height:28px}
.ldh-chat-sms-toggle{display:inline-flex!important;align-items:center;gap:.5rem;position:relative;min-height:28px;cursor:pointer;color:var(--ldh-ink);font-weight:600}
.ldh-chat-sms-toggle[hidden]{display:none!important}
.ldh-chat-sms-toggle input{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}
.ldh-chat-switch-track{display:inline-flex;align-items:center;width:38px;height:22px;padding:2px;border:1px solid var(--ldh-line);border-radius:999px;background:var(--ldh-surface-soft);transition:background-color .16s ease,border-color .16s ease}
.ldh-chat-switch-thumb{display:block;width:16px;height:16px;border-radius:50%;background:var(--ldh-surface);border:1px solid var(--ldh-line);box-shadow:var(--ldh-shadow-sm);transition:transform .16s ease}
.ldh-chat-sms-toggle input:checked+.ldh-chat-switch-track{background:var(--ldh-green-700);border-color:var(--ldh-green-700)}
.ldh-chat-sms-toggle input:checked+.ldh-chat-switch-track .ldh-chat-switch-thumb{transform:translateX(16px);border-color:var(--ldh-surface)}
.ldh-chat-sms-toggle input:focus-visible+.ldh-chat-switch-track{outline:2px solid var(--ldh-focus);outline-offset:2px}

/* Header bubble opens the same chat in a compact, reusable workspace. */
.ldh-topbar-chat{cursor:pointer;font:inherit}
.ldh-topbar-chat[aria-expanded=true]{background:var(--ldh-green-100);border-color:var(--ldh-green-700)}
.ldh-chat-popover[hidden]{display:none!important}
.ldh-chat-popover{position:fixed;z-index:1300;top:64px;right:16px;width:min(420px,calc(100vw - 24px));height:min(640px,calc(100dvh - 80px));display:flex;flex-direction:column;overflow:hidden;padding:0;border:1px solid var(--ldh-line);border-radius:var(--ldh-radius);background:var(--ldh-surface);box-shadow:var(--ldh-shadow-md)}
.ldh-chat-popover-head{height:48px;min-height:48px;display:flex;align-items:center;gap:.65rem;padding:0 .75rem;border-bottom:1px solid var(--ldh-line-soft);background:var(--ldh-surface)}
.ldh-chat-popover-head strong{flex:1;font-size:.9rem;color:var(--ldh-ink)}
.ldh-chat-popover-head a{font-size:.72rem;font-weight:700;color:var(--ldh-green-800);text-decoration:none}
.ldh-chat-popover-head a:hover{text-decoration:underline}
.ldh-chat-popover-head button{width:34px;height:34px;display:grid;place-items:center;flex:none;border:1px solid var(--ldh-line);border-radius:var(--ldh-radius);background:var(--ldh-surface);color:var(--ldh-green-900);cursor:pointer}
.ldh-chat-popover-head button:hover{background:var(--ldh-green-100)}
.ldh-chat-popover :is(button,a):focus-visible{outline:2px solid var(--ldh-focus);outline-offset:2px}
.ldh-chat-popover iframe{display:block;width:100%;height:100%;min-height:0;flex:1;border:0;background:var(--ldh-page)}
body.ldh-chat-embed{margin:0;min-width:0;background:var(--ldh-page)}
.ldh-chat-embed .ldh-chat-page{max-width:none;width:100%;min-width:0;padding:.65rem}
.ldh-chat-embed .ldh-chat-page-head{align-items:center;justify-content:flex-end;gap:.4rem;min-height:34px}
.ldh-chat-embed .ldh-chat-page-head .ldh-eyebrow,.ldh-chat-embed .ldh-chat-page-head p{display:none}
.ldh-chat-embed .ldh-chat-page-head h1{display:none}
.ldh-chat-embed .ldh-chat-page-head .ldh-chat-secondary{min-height:34px;max-width:145px;padding:.25rem .4rem;font-size:.67rem}
.ldh-chat-embed .ldh-chat-layout{min-height:calc(100dvh - 74px);margin-top:.55rem}
.ldh-chat-embed .ldh-chat-sidebar{min-height:calc(100dvh - 74px)}
.ldh-chat-embed .ldh-chat-active{height:calc(100dvh - 74px);min-height:280px}
.ldh-chat-embed .ldh-chat-empty{min-height:calc(100dvh - 90px)}
.ldh-chat-embed .ldh-chat-messages{min-height:0}
.ldh-chat-embed .ldh-chat-message{max-width:95%}
.ldh-chat-embed .ldh-chat-composer{padding:.5rem}
.ldh-chat-embed .ldh-chat-compose-row{gap:.3rem}
.ldh-chat-embed .ldh-chat-compose-row .ldh-chat-attach,.ldh-chat-embed .ldh-chat-compose-row .ldh-chat-icon-button,.ldh-chat-embed .ldh-chat-compose-row .ldh-chat-send{width:40px;min-width:40px;height:44px}
@media(max-width:767.98px){.ldh-chat-popover{inset:56px 0 0;width:100vw;height:calc(100dvh - 56px);border-radius:0;border-left:0;border-right:0;border-bottom:0}.ldh-chat-popover-head{height:46px;min-height:46px}.ldh-chat-compose-row{gap:.3rem}.ldh-chat-compose-row .ldh-chat-attach,.ldh-chat-compose-row .ldh-chat-icon-button,.ldh-chat-compose-row .ldh-chat-send{width:44px;min-width:44px}}
@media(prefers-reduced-motion:reduce){.ldh-chat-switch-track,.ldh-chat-switch-thumb{transition:none}}
@media(max-width:767.98px){body.ldh-chat-popover-open{overflow:hidden}}
.ldh-chat-picker-fields{display:grid;gap:16px;margin:0 0 16px}
.ldh-chat-picker-field{display:grid;gap:7px;min-width:0}
.ldh-chat-picker-field label{font-size:.75rem;font-weight:700;color:var(--ldh-ink)}
.ldh-chat-dialog .ldh-chat-picker-field input{min-height:44px}
.ldh-chat-dialog .ldh-chat-picker-field input[aria-invalid=true]{border-color:var(--ldh-red-600)}
.ldh-chat-field-error{margin:0;font-size:.72rem;font-weight:700;color:var(--ldh-red-600)}
.ldh-chat-field-error[hidden]{display:none!important}
.ldh-chat-picker-note{margin:0 0 16px;padding:10px 12px;border:1px solid var(--ldh-green-200);border-radius:var(--ldh-radius);background:var(--ldh-green-100);color:var(--ldh-green-900);font-size:.76rem;line-height:1.45}
