/* WhatsApp-style workspace. These tokens and overrides belong only to Conversas. */
.view--conversations {
  --chat-panel:#111b21; --chat-header:#202c33; --chat-canvas:#0b141a;
  --chat-incoming:#202c33; --chat-outgoing:#005c4b; --chat-text:#e9edef;
  --chat-muted:#aebac1; --chat-line:#26343d; --chat-hover:#202c33;
  --chat-active:#2a3942; --chat-input:#2a3942; --chat-accent:#00a884;
  --chat-pill:#233138; --chat-search:#202c33; --chat-avatar:#28463e;
  --chat-shadow:0 1px 1px #0003; --chat-bubble-muted:#c2d1d0;
  width:100%;max-width:none;margin:0;padding:0;height:calc(100dvh - var(--topbar-h));
  min-height:0;display:flex;flex-direction:column;color:var(--chat-text);
}
[data-theme="light"] .view--conversations {
  --chat-panel:#fff; --chat-header:#f5f6f7; --chat-canvas:#f1f4f6;
  --chat-incoming:#fff; --chat-outgoing:#d9fdd3; --chat-text:#111b21;
  --chat-muted:#667781; --chat-line:#e9edef; --chat-hover:#f5f6f6;
  --chat-active:#eef2f5; --chat-input:#fff; --chat-accent:#008069;
  --chat-pill:#fff; --chat-search:#f0f2f5; --chat-avatar:#dbece5;
  --chat-shadow:0 1px 1px #0b141a1c; --chat-bubble-muted:#52646c;
}
.view--conversations .chat-page { height:100%;min-height:0;flex:1; }
.view--conversations .chat-shell { grid-template-columns:350px minmax(0,1fr);border:0;border-radius:0;background:var(--chat-panel); }
.view--conversations .chat-side { background:var(--chat-panel);border-color:var(--chat-line); }
.chat-list-header { min-height:68px;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:14px 20px 8px; }
.chat-list-header h1 { font:650 23px/1.2 var(--font-sans);letter-spacing:-.6px;margin:0;color:var(--chat-text); }
.chat-list-actions { display:flex;align-items:center;gap:3px; }
.view--conversations .icon-btn { color:var(--chat-muted);width:36px;height:36px;flex-shrink:0;border-radius:50%; }
.view--conversations .icon-btn:hover { background:var(--chat-hover);color:var(--chat-text); }
.view--conversations .chat-side-head { min-height:34px;padding:0 14px 8px;gap:5px;border:0; }
.view--conversations .chat-side-head .select { height:30px;border:0;background:transparent;color:var(--chat-muted);font-size:11px;padding-left:5px;box-shadow:none; }
.chat-instance-dot { width:7px;height:7px;flex:0 0 7px;border-radius:50%;background:var(--chat-muted);margin-left:7px; }
.is-connected .chat-instance-dot { background:var(--chat-accent); }
.view--conversations .chat-search { margin:0 12px 10px;padding:0 10px 0 13px;height:38px;border-radius:8px;background:var(--chat-search);gap:12px;color:var(--chat-muted); }
.view--conversations .chat-search .input { border:0;background:transparent;height:36px;padding:0;font-size:13px;color:var(--chat-text);box-shadow:none; }
.view--conversations .chat-search .input::placeholder { color:var(--chat-muted);opacity:1; }
.chat-filters { display:flex;gap:7px;padding:0 13px 13px;border-bottom:1px solid var(--chat-line); }
.chat-filters button { border:0;border-radius:24px;background:var(--chat-search);color:var(--chat-muted);font-size:12px;line-height:1;padding:9px 14px;cursor:pointer;min-height:32px; }
.chat-filters button[aria-pressed="true"] { background:color-mix(in srgb,var(--chat-accent) 16%,var(--chat-panel));color:var(--chat-accent);font-weight:600; }
.view--conversations .chat-new { padding:10px 12px;background:var(--chat-header);border-color:var(--chat-line); }
.view--conversations .chat-new[hidden] { display:none; }
.view--conversations .chat-new .input { height:38px;font-size:13px; }
.view--conversations .chat-item { gap:13px;min-height:79px;padding:13px 16px;border-color:var(--chat-line);background:var(--chat-panel);color:var(--chat-text); }
.view--conversations .chat-item:hover { background:var(--chat-hover); }
.view--conversations .chat-item.is-active { background:var(--chat-active); }
.view--conversations .avatar { width:46px;height:46px;border-radius:50%;background:var(--chat-avatar);border:0;color:var(--chat-text);font-size:15px;letter-spacing:.2px;overflow:hidden;flex-shrink:0; }
.view--conversations .avatar img { width:100%;height:100%;object-fit:cover; }
.view--conversations .chat-body { gap:5px; }
.view--conversations .chat-item-top strong { font-size:14px;font-weight:600; }
.view--conversations .chat-item-top>span { font-size:11px;color:var(--chat-muted); }
.view--conversations .chat-preview { font-size:13px;color:var(--chat-muted);line-height:1.4; }
.chat-list-footer { display:flex;align-items:center;gap:6px;padding:10px 14px;color:var(--chat-muted);font-size:10px;border-top:1px solid var(--chat-line); }
.chat-list-footer a { color:inherit;margin-left:auto;display:flex;align-items:center;justify-content:center;width:28px;min-height:28px;border-radius:50%; }
.view--conversations .thread-head { height:68px;min-height:68px;padding:10px 22px;gap:12px;background:var(--chat-header);border-bottom:1px solid var(--chat-line); }
.view--conversations .thread-head .avatar { width:42px;height:42px;border-radius:50%; }
.view--conversations .thread-who { gap:3px;flex:1; }
.view--conversations .thread-who strong { font-size:15px;font-weight:600;color:var(--chat-text); }
.view--conversations .thread-who span { font-size:12px;color:var(--chat-muted); }
.view--conversations #thread-status { font-size:10px;white-space:nowrap;gap:5px;color:var(--chat-muted); }
.view--conversations #thread-status::before { width:6px;height:6px; }
.view--conversations .thread-actions { display:flex;flex-wrap:nowrap;align-items:center;gap:6px;margin-left:8px;padding:0;border:0;background:none; }
.view--conversations .thread-messages { background:var(--chat-canvas);padding:22px clamp(22px,5vw,88px) 26px;gap:3px;scrollbar-gutter:stable; }
.view--conversations .msg-day { background:var(--chat-pill);color:var(--chat-muted);font-size:10px;letter-spacing:0;font-weight:500;padding:5px 12px;line-height:1.3;border:0;border-radius:8px;box-shadow:var(--chat-shadow);margin:0 auto 14px; }
.view--conversations .msg-row { padding:1px 0;position:relative;flex-shrink:0; }
.view--conversations .msg { position:relative;max-width:min(78%,560px);min-width:90px;padding:7px 10px 5px;background:var(--chat-incoming);color:var(--chat-text);border:0;border-radius:0 9px 9px 9px;box-shadow:var(--chat-shadow);font-size:14px;line-height:1.45; }
.view--conversations .msg-row.is-out .msg { border-radius:9px 0 9px 9px;background:var(--chat-outgoing);color:var(--chat-text);border:0; }
.view--conversations .msg::before { content:"";position:absolute;top:0;left:-7px;width:8px;height:12px;background:var(--chat-incoming);clip-path:polygon(0 0,100% 0,100% 100%); }
.view--conversations .msg-row.is-out .msg::before { left:auto;right:-7px;background:var(--chat-outgoing);transform:scaleX(-1); }
.view--conversations .msg-meta { display:flex;justify-content:flex-end;align-items:center;gap:4px;margin:3px 0 0 20px; }
.view--conversations .msg-time { font-size:10px;line-height:1.2;margin:0;color:var(--chat-muted); }
.msg-sent { display:inline-flex;color:var(--chat-muted); }
.view--conversations .msg-kind { display:none; }
.view--conversations .msg-actions { position:absolute;right:5px;top:2px;padding:2px 3px;border-radius:8px;background:var(--chat-incoming);opacity:0;transition:opacity var(--dur-fast);margin:0;z-index:2; }
.view--conversations .is-out .msg-actions { background:var(--chat-outgoing); }
.view--conversations .msg:hover .msg-actions,.view--conversations .msg:focus-within .msg-actions { opacity:1; }
.view--conversations .msg-action { min-height:26px;min-width:26px;font-size:11px;color:var(--chat-muted); }
.view--conversations .msg-reply { position:static;opacity:1;visibility:visible;width:26px;height:26px;padding:3px;border:0;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;color:var(--chat-muted);background:none; }
.view--conversations .msg-media-open { font-size:12px;color:var(--chat-accent);margin:5px 0; }
.chat-image { display:block;max-width:100%;max-height:300px;border-radius:6px;object-fit:contain; }
.chat-audio { display:flex;align-items:center;gap:10px;min-width:250px;padding:8px 0 3px; }
.chat-audio-play { width:40px;height:40px;flex:0 0 40px;display:grid;place-items:center;border:0;border-radius:50%;background:color-mix(in srgb,var(--chat-accent) 20%,transparent);color:var(--chat-accent);cursor:pointer; }
.chat-audio-track { min-width:0;flex:1; }
.chat-audio input[type=range] { width:100%;accent-color:var(--chat-accent);height:20px;cursor:pointer; }
.chat-audio-time { font-size:10px;color:var(--chat-muted);font-variant-numeric:tabular-nums; }
.chat-audio-speed { font-size:11px;border:0;border-radius:12px;padding:5px;color:var(--chat-muted);background:transparent;cursor:pointer;min-width:30px;min-height:30px; }
.chat-media-error { font-size:11px;color:var(--chat-muted);margin:5px 0; }
.view--conversations .compose { min-height:76px;background:var(--chat-header);padding:13px 22px;gap:12px;align-items:center;border-top:1px solid var(--chat-line); }
.view--conversations .compose textarea { min-height:46px;height:46px;max-height:120px;line-height:22px;padding:12px 15px;border:0;border-radius:10px;background:var(--chat-input);color:var(--chat-text);font:14px/22px var(--font-sans);resize:none; }
.view--conversations .compose textarea::placeholder { color:var(--chat-muted); }
.view--conversations .compose-send { border:0;border-radius:50%;width:44px;height:44px;min-height:44px;min-width:44px;padding:0;display:grid;place-items:center;background:var(--chat-accent);color:#fff;box-shadow:none; }
.view--conversations .compose-send:hover { background:color-mix(in srgb,var(--chat-accent) 85%,#000); }
.compose-emojis { position:relative;flex-shrink:0;color:var(--chat-muted); }
.compose-emojis summary { list-style:none;display:grid;place-items:center;width:32px;height:40px;cursor:pointer;border-radius:50%; }
.compose-emojis summary::-webkit-details-marker { display:none; }
.emoji-picker { position:absolute;bottom:56px;left:-10px;background:var(--chat-panel);border:1px solid var(--chat-line);box-shadow:0 8px 32px #0002;border-radius:12px;padding:10px;display:grid;grid-template-columns:repeat(6,36px);gap:2px;z-index:5; }
.emoji-picker button { display:grid;place-items:center;width:36px;height:36px;border:0;background:none;border-radius:6px;font-size:23px;cursor:pointer; }
.emoji-picker button:hover { background:var(--chat-hover); }
.view--conversations .reply-preview { padding:10px 22px;background:var(--chat-header);border-color:var(--chat-line); }
.view--conversations .reply-preview>div { border-left:3px solid var(--chat-accent);padding-left:10px; }
.view--conversations .reply-preview span { color:var(--chat-accent);font-size:11px; }
.view--conversations .reply-preview strong { font-size:12px;color:var(--chat-muted); }
.view--conversations .chat-placeholder { display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;height:100%;max-width:330px;margin:auto;line-height:1.6;text-align:center;color:var(--chat-muted);font-size:13px; }
.view--conversations .chat-placeholder strong { font-size:23px;font-weight:400;color:var(--chat-text); }
.view--conversations .chat-readonly { background:var(--chat-header);border-color:var(--chat-line);color:var(--chat-muted); }
.view--conversations .chat-shell.has-tools { grid-template-columns:300px minmax(250px,1fr) 320px; }
.view--conversations .chat-workbench { background:var(--chat-panel);color:var(--chat-text);border-color:var(--chat-line); }
@media (max-width:1250px) and (min-width:761px) {
 .view--conversations .chat-shell { grid-template-columns:310px minmax(0,1fr); }
 .view--conversations .chat-shell.has-tools { grid-template-columns:minmax(250px,1fr) 320px; }
 .view--conversations .chat-shell.has-tools .chat-side { display:none; }
 .view--conversations .thread-messages { padding-left:24px;padding-right:24px; }
}
@media (max-width:760px) {
 .view--conversations .chat-shell,.view--conversations .chat-shell.has-tools { grid-template-columns:minmax(0,1fr); }
 .view--conversations .chat-thread { display:none; }
 .view--conversations .chat-shell.is-thread .chat-thread { display:flex; }
 .view--conversations .chat-shell.is-thread .chat-side { display:none; }
 .view--conversations .chat-shell.has-tools .chat-side,.view--conversations .chat-shell.has-tools .chat-thread { display:none; }
 .view--conversations .chat-shell.has-tools .chat-workbench { display:flex; }
 .view--conversations .thread-head { padding:8px 10px;gap:8px;min-height:62px;height:62px; }
 .view--conversations .thread-actions { gap:0;margin-left:0; }
 .view--conversations .thread-actions .icon-btn { width:32px; }
 .view--conversations #thread-status { display:none; }
 .view--conversations .thread-who strong { font-size:14px; }
 .view--conversations .thread-who span { font-size:11px; }
 .view--conversations .thread-messages { padding:16px 14px 20px; }
 .view--conversations .msg { max-width:88%;font-size:14px; }
 .view--conversations .compose { padding:10px;gap:5px;min-height:70px; }
 .view--conversations .compose textarea { padding:11px 12px; }
 .view--conversations .compose-send { width:40px;height:40px;min-width:40px;min-height:40px; }
 .view--conversations .compose>.icon-btn { width:32px; }
 .view--conversations .reply-preview { padding:10px 14px; }
 .chat-audio { min-width:220px; }
}
@media(hover:none) {
 .view--conversations .msg-actions { position:static;opacity:1;padding:0;justify-content:flex-end; }
}
@media(prefers-reduced-motion:reduce) {
 .view--conversations * { scroll-behavior:auto;transition:none;animation:none; }
}

.view--conversations .msg-time,.view--conversations .msg-sent,.chat-audio-time,.chat-audio-speed { color:var(--chat-bubble-muted); }
/* Reserve media geometry while files load or expire. */
.view--conversations .chat-media:has(.chat-image) { width:280px;max-width:100%;height:200px;display:grid;place-items:center;border-radius:6px;background:var(--chat-canvas);overflow:hidden; }
.view--conversations .chat-image { width:100%;height:100%;max-height:200px;object-fit:contain; }

/* Non-modal call widget. Remains usable while switching conversations. */
.softphone { position:fixed;right:24px;bottom:24px;z-index:80;width:320px;max-width:calc(100vw - 24px);margin:0;border:1px solid var(--chat-line,var(--border));border-radius:18px;background:var(--chat-panel,var(--surface));color:var(--chat-text,var(--text));box-shadow:0 14px 48px #0003;overflow:hidden; }
.softphone-heading { display:flex;align-items:center;justify-content:space-between;padding:10px 12px 10px 18px;background:var(--chat-accent,var(--accent-lime));color:var(--chat-panel,var(--surface)); }
.softphone-heading>span { display:flex;align-items:center;gap:7px;font-size:11px;font-weight:600; }
.softphone-heading>div { display:flex;gap:2px; }
.softphone-heading .icon-btn { color:inherit;width:30px;height:30px;min-height:30px;border-radius:8px;cursor:pointer; }
.softphone-heading .icon-btn:hover { background:#ffffff26; }
.softphone-main { display:flex;flex-direction:column;align-items:center;text-align:center;gap:14px;padding:24px 20px 12px; }
.softphone-main>div { display:flex;flex-direction:column;align-items:center;gap:6px;min-width:0;max-width:100%; }
.softphone-main strong { font-size:19px;line-height:1.3;font-weight:600;overflow-wrap:anywhere; }
.softphone-main [data-softphone-number] { color:var(--chat-muted,var(--muted));font-size:11px;overflow-wrap:anywhere; }
.softphone-main [role=status] { color:var(--chat-accent,var(--text));font-size:12px;line-height:1.5; }
.softphone-icon { width:68px;height:68px;display:grid;place-items:center;background:var(--chat-avatar,var(--accent-soft));color:var(--chat-accent,var(--accent-lime));border-radius:50%;flex-shrink:0; }
.softphone-timer { font-variant-numeric:tabular-nums;font-size:18px;font-weight:500;letter-spacing:1px;line-height:1.4; }
.softphone-controls { display:flex;gap:18px;align-items:flex-start;justify-content:center;padding:16px 16px 20px; }
.softphone-action { display:flex;flex-direction:column;align-items:center;gap:8px;width:62px;border:0;background:none;color:var(--chat-text,var(--text));font:inherit;cursor:pointer;padding:0;border-radius:12px; }
.softphone-action>svg { box-sizing:content-box;padding:13px;border-radius:50%;background:var(--chat-canvas,var(--surface));transition:background .15s; }
.softphone-action>span { font-size:10px;line-height:1.4; }
.softphone-action:hover>svg { background:var(--chat-avatar,var(--accent-soft)); }
.softphone-action:focus-visible,.softphone-heading button:focus-visible,.softphone-footer summary:focus-visible { outline:2px solid var(--chat-accent,var(--accent-lime));outline-offset:4px; }
.softphone-action:disabled { opacity:.45;cursor:wait; }
.softphone-end>svg,.softphone-end:hover>svg { background:var(--danger);color:var(--text-inverse,#fff);transform:rotate(135deg); }
.softphone-join>svg { background:var(--chat-accent,var(--accent-lime));color:var(--chat-panel,var(--surface)); }
.softphone-controls [aria-pressed=true]>svg { background:var(--danger-soft);color:var(--danger); }
.softphone-error { font-size:12px;line-height:1.5;color:var(--danger);padding:0 20px;margin:8px 0;overflow-wrap:anywhere; }
.softphone-footer { border-top:1px solid var(--chat-line,var(--border));padding:10px 16px;text-align:center;color:var(--chat-muted,var(--muted));font-size:10px;line-height:1.5; }
.softphone-footer details { margin-top:5px; }
.softphone-footer summary { cursor:pointer;list-style:none;text-decoration:underline;text-underline-offset:3px; }
.softphone-footer summary::-webkit-details-marker { display:none; }
.softphone-audio { display:flex;justify-content:center;gap:10px;margin-top:8px;flex-wrap:wrap;font-size:10px; }
.softphone[data-minimized=true] { width:280px; }
.softphone[data-minimized=true] .softphone-main { flex-direction:row;text-align:left;padding:12px 16px;gap:12px; }
.softphone[data-minimized=true] .softphone-main>div { align-items:flex-start;gap:3px; }
.softphone[data-minimized=true] .softphone-main strong { font-size:13px; }
.softphone[data-minimized=true] .softphone-icon { width:38px;height:38px; }
.softphone[data-minimized=true] .softphone-icon>svg { width:18px;height:18px; }
.softphone[data-minimized=true] .softphone-main [data-softphone-number],.softphone[data-minimized=true] .softphone-footer,.softphone[data-minimized=true] .softphone-controls [data-softphone-mute],.softphone[data-minimized=true] .softphone-controls [data-softphone-output] { display:none; }
.softphone[data-minimized=true] .softphone-controls { padding:0 16px 12px;gap:12px; }
.softphone[data-minimized=true] .softphone-timer { font-size:12px; }
@media(max-width:760px){ .softphone { right:12px;bottom:max(12px,env(safe-area-inset-bottom));width:300px;max-height:calc(100dvh - 24px);overflow:auto; }.softphone-main{padding:18px 16px 10px;gap:12px;}.softphone-icon{width:56px;height:56px;} }
@media(prefers-reduced-motion:reduce){.softphone *{transition:none;}}
