.team-chat{position:fixed;right:max(18px,env(safe-area-inset-right));bottom:calc(18px + env(safe-area-inset-bottom));z-index:350;font:14px system-ui,-apple-system,Segoe UI,sans-serif;color:#17304e}
.team-chat[hidden],.team-chat .chat-panel[hidden],.team-chat .chat-badge[hidden]{display:none!important}
.chat-bubble{position:relative;width:56px;height:56px;border:0;border-radius:50%;background:#0b55a3;color:#fff;font-size:26px;box-shadow:0 8px 26px #123c6a55;cursor:pointer;opacity:.65;transition:opacity .2s,transform .2s}
.chat-bubble:hover,.chat-bubble:focus-visible,.chat-bubble.unread,.chat-bubble[aria-expanded="true"]{opacity:1;transform:translateY(-2px)}
.chat-badge{position:absolute;top:-5px;right:-5px;min-width:23px;height:23px;padding:2px 5px;border-radius:20px;background:#d72838;color:#fff;font:700 12px/19px system-ui;text-align:center;border:2px solid #fff}
.chat-panel{position:absolute;right:0;bottom:70px;width:min(390px,calc(100vw - 22px));height:min(540px,calc(100dvh - 105px));display:flex;flex-direction:column;background:#fff;border:1px solid #cad9ec;border-radius:16px;box-shadow:0 20px 60px #102e5555;overflow:hidden}
.chat-new-messages{position:absolute;z-index:3;right:16px;bottom:72px;border:1px solid #c4d8ef;border-radius:999px;padding:9px 14px;background:#fff;color:#0b55a3;box-shadow:0 5px 18px #123c6a24;font:700 13px system-ui,-apple-system,Segoe UI,sans-serif;cursor:pointer}.chat-new-messages[hidden]{display:none!important}
.chat-panel header{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;padding:14px 16px;background:#0d4d95;color:#fff}
.chat-panel header strong,.chat-panel header small{display:block}.chat-panel header strong{font-size:16px}.chat-panel header small{font-size:11px;line-height:1.35;color:#dfecfb;margin-top:2px}
.chat-close{border:0;background:transparent;color:#fff;font-size:27px;line-height:1;cursor:pointer}
.chat-messages{flex:1;overflow:auto;padding:14px;display:flex;flex-direction:column;gap:10px;background:#f3f7fc;overscroll-behavior:contain}
.chat-message{align-self:flex-start;width:fit-content;max-width:91%;padding:10px 12px;border:1px solid #d4e1f1;border-radius:12px 12px 12px 3px;background:#fff;overflow-wrap:anywhere}
.chat-message.own{align-self:flex-end;border-color:#9cc7ea;background:#e7f3ff;border-radius:12px 12px 3px 12px}
.chat-message small{display:block;font-weight:700;font-size:11px}.chat-message p{margin:5px 0 0;line-height:1.45;white-space:pre-wrap}.chat-message strong{display:block;margin-top:6px}.chat-message a{display:inline-block;margin-top:8px;font-weight:700;color:#0b55a3}.chat-message audio{display:block;max-width:100%;width:240px;margin-top:6px}
.chat-error{min-height:0;color:#b21c2b;font-size:12px;padding:0 14px}.chat-error:not(:empty){padding:7px 14px;background:#fff0f0}
.chat-share-chip[hidden]{display:none}.chat-share-chip{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:9px 12px;background:#eaf3ff;border-top:1px solid #bad5f1;color:#174f8c;font-size:12px;font-weight:700}.chat-share-chip button{border:0;background:transparent;color:#174f8c;font-size:21px;line-height:1;cursor:pointer}
.chat-composer{display:flex;align-items:flex-end;gap:8px;padding:10px;background:#fff;border-top:1px solid #dbe5f0}.chat-composer textarea{flex:1;min-width:0;max-height:90px;resize:vertical;border:1px solid #c7d6e8;border-radius:9px;padding:9px;font:inherit}.chat-composer-actions{display:flex;gap:5px}.chat-composer button{min-height:38px;border:0;border-radius:8px;padding:7px 10px;background:#0b55a3;color:#fff;font-weight:700;cursor:pointer}.chat-composer button:disabled{opacity:.5}.chat-composer .chat-record{background:#eaf2fb;color:#0b55a3}.chat-composer .chat-record.recording{background:#d72838;color:#fff}
@media(max-width:480px){.team-chat{right:12px;bottom:calc(12px + env(safe-area-inset-bottom))}.chat-panel{height:min(540px,calc(100dvh - 96px));bottom:66px}.chat-bubble{width:52px;height:52px}}
.chat-bubble{display:grid;place-items:center;padding:0;background:#15549b;border:2px solid #fff;box-shadow:0 6px 18px #183e6b4d;line-height:1}
.chat-bubble svg{display:block;width:27px;height:27px;margin:auto}
.chat-bubble[aria-expanded="true"]{visibility:hidden}
.chat-panel{bottom:0;height:min(580px,calc(100dvh - 36px));border-radius:18px}
.chat-panel header{align-items:center;background:#15549b;padding:12px 16px}
.chat-panel header>div:first-child{min-width:0;flex:1}
.chat-header-actions{display:flex;align-items:center;gap:6px;flex:none}
.chat-alerts,.chat-close{display:grid;place-items:center;flex:none;box-sizing:border-box;width:36px;height:36px;padding:0;border-radius:10px;color:#fff;cursor:pointer}
.chat-assistant-call{display:grid;place-items:center;flex:none;box-sizing:border-box;width:36px;height:36px;padding:0;border:1px solid #ffffff66;border-radius:10px;background:#ffffff18;color:#fff;cursor:pointer;transition:background .18s,transform .18s}
.chat-assistant-call:hover,.chat-assistant-call:focus-visible{background:#ffffff30;transform:translateY(-1px);outline:2px solid #fff;outline-offset:2px}
.chat-assistant-call svg{display:block;width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.chat-alerts{position:relative;border:1px solid #ffffff66;background:transparent}
.chat-alerts.enabled:after{content:'';position:absolute;right:4px;top:4px;width:7px;height:7px;border-radius:50%;background:#73e1b0;border:1px solid #15549b}
.chat-alerts svg,.chat-close svg{display:block;width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.chat-close{border:0;background:transparent}
.chat-row.notification-target .chat-message{animation:ma-message-arrival 2.6s ease-out;border-color:#0b55a3;box-shadow:0 0 0 4px #0b55a333,0 5px 20px #123c6a22}
@keyframes ma-message-arrival{0%,100%{transform:translateY(0)}20%{transform:translateY(-3px)}}
.chat-panel header small{font-size:10px}
.chat-messages{gap:12px;background:linear-gradient(145deg,#f0f6fd,#f9fbff)}
.chat-row{display:flex;align-items:flex-start;gap:7px;max-width:96%}
.chat-row.own{align-self:flex-end;flex-direction:row-reverse}
.chat-avatar{flex:none;display:grid;place-items:center;width:30px;height:30px;border-radius:50%;color:white;font-weight:800;overflow:hidden}
.chat-avatar img{width:100%;height:100%;object-fit:cover}
.chat-message{max-width:calc(100% - 37px);min-width:90px;box-shadow:0 2px 9px #123c6a0c}
.chat-row.own .chat-message{background:#e7f3ff;border-color:#a8cceb;border-radius:12px 12px 3px 12px}
.chat-message-head{display:flex;align-items:baseline;flex-wrap:wrap;gap:2px 6px}
.chat-message-head strong{font-size:11px;margin:0}
.chat-role{color:#74859b;font-size:10px}
.chat-message time{display:block;margin-top:4px;text-align:right;color:#8796a7;font-size:10px}
.chat-message .chat-document-title{margin-top:8px;color:#163b65;font-size:13px}
.chat-audio{display:grid;grid-template-columns:36px minmax(0,1fr) auto;align-items:center;gap:8px;width:min(245px,65vw);margin-top:7px}
.chat-audio audio{display:none}
.chat-audio-play{display:grid;place-items:center;width:36px;height:36px;padding:0;border:0;border-radius:50%;background:#15549b;color:#fff;cursor:pointer}
.chat-audio-play:hover,.chat-audio-play:active,.chat-audio-play:focus-visible{background:#0e4688;color:#fff}
.chat-audio-play svg{display:block;width:20px;height:20px;fill:currentColor}
.chat-audio-play .audio-icon-pause,.chat-audio-play.playing .audio-icon-play{display:none}
.chat-audio-play.playing .audio-icon-pause{display:block}
.chat-audio-play:focus-visible,.chat-audio input:focus-visible{outline:2px solid #113c75;outline-offset:3px}
.chat-audio input[type=range]{appearance:none;-webkit-appearance:none;min-width:0;width:100%;height:4px;margin:0;border:0;border-radius:999px;background:linear-gradient(to right,#15549b 0 var(--progress,0%),#bdcee1 var(--progress,0%) 100%);cursor:pointer}
.chat-audio input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:12px;height:12px;border:0;border-radius:50%;background:#15549b;box-shadow:0 0 0 2px #fff}
.chat-audio input[type=range]::-moz-range-thumb{width:12px;height:12px;border:0;border-radius:50%;background:#15549b;box-shadow:0 0 0 2px #fff}
.chat-audio span{font-size:10px;color:#617792;white-space:nowrap;font-variant-numeric:tabular-nums}
.chat-composer{border-top-color:#c9dbee;box-shadow:0 -3px 12px #103d6710;align-items:end;box-sizing:border-box}
.chat-composer .chat-attach{flex:none;width:40px;height:40px;min-height:40px;padding:0;border-radius:50%;background:#e8f2ff;color:#15549b}
.chat-composer .chat-attach[hidden],.chat-picker[hidden]{display:none!important}
.chat-picker{display:grid;grid-template-columns:minmax(0,1fr) 92px;gap:7px;padding:10px;border-top:1px solid #c9dbee;background:#f4f9ff}
.chat-picker label{display:grid;gap:3px;min-width:0;color:#295479;font-size:11px;font-weight:700}
.chat-picker select{width:100%;min-width:0;min-height:36px;border:1px solid #b9d2ed;border-radius:8px;background:#fff;color:#17304e;padding:4px}
.chat-pick-confirm{grid-column:1/-1;justify-self:start;border:0;border-radius:8px;background:#15549b;color:#fff;padding:8px 12px;font-weight:700;cursor:pointer}
.chat-composer textarea{box-sizing:border-box;height:40px;min-height:40px;border-radius:16px;padding:9px 12px;line-height:20px;resize:none}
.chat-composer-actions{display:flex;align-items:center;gap:6px;flex:none}
.chat-composer .chat-send,.chat-composer .chat-record{display:grid;place-items:center;flex:none;box-sizing:border-box;border-radius:50%;width:40px;height:40px;min-height:40px;padding:0;line-height:1}
.chat-composer svg{display:block;width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.chat-composer .chat-record .record-stop{display:none;fill:currentColor;stroke:none}
.chat-composer .chat-record.recording .record-mic{display:none}
.chat-composer .chat-record.recording .record-stop{display:block}
@media(max-width:480px){.chat-panel{bottom:0;height:min(580px,calc(100dvh - 28px))}.chat-bubble svg{width:26px;height:26px}.chat-composer{gap:6px;padding:8px}.chat-composer textarea{min-width:0}.chat-composer-actions{gap:5px}.chat-composer .chat-attach,.chat-composer .chat-send,.chat-composer .chat-record{width:40px;height:40px;min-height:40px}}
.chat-row.selected .chat-message{outline:2px solid #3b82c4;background:#dcecff}.chat-message-actions{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px;padding-top:7px;border-top:1px solid #d9e5f1}.chat-message-actions button{border:1px solid #c8d9eb;border-radius:8px;background:#fff;color:#15549b;padding:5px 9px;font-family:inherit;font-size:11px;font-weight:600;line-height:1.2;cursor:pointer}.chat-reply-quote{display:grid;gap:2px;margin:0 0 7px;padding:6px 8px;border-left:3px solid #15549b;border-radius:5px;background:#eaf3ff;color:#526b86;font-size:11px}.chat-reply-quote strong{color:#15549b}.chat-deleted{color:#77889a!important;font-style:italic}.chat-edited{display:block;margin-top:3px;color:#77889a;font-size:10px;font-style:italic}
.chat-assistant-confirm{display:inline-flex;align-items:center;justify-content:center;min-height:36px;margin-top:9px;padding:8px 14px;border:0;border-radius:999px;background:#087f5b;color:#fff;font-family:inherit;font-size:12px;font-weight:700;line-height:1.2;cursor:pointer;box-shadow:0 2px 6px #087f5b24}.chat-assistant-confirm:hover,.chat-assistant-confirm:focus-visible{background:#066b4d}.chat-assistant-confirm:focus-visible{outline:2px solid #15549b;outline-offset:2px}.chat-assistant-confirm:disabled{background:#6b8d80;cursor:default;box-shadow:none}
@media print{.team-chat{display:none!important}}
