.chat-admin summary { cursor:pointer; font-weight:600; }
.chat-admin form { margin:16px 0; }
.chat-admin ul { padding:0; list-style:none; }
.chat-admin li { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:8px 0; border-top:1px solid var(--line); overflow-wrap:anywhere; }
.chat-admin .secondary { padding:5px 12px; }
#staff-requests li { justify-content:flex-start; flex-wrap:wrap; }
#staff-requests li span { flex:1 1 140px; }
.staff-enrollment { margin-top:20px; padding:clamp(16px,3vw,28px); background:#fff; border:1px solid var(--line); border-radius:14px; }
.staff-enrollment header,.staff-enrollment li { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.staff-enrollment header { flex-wrap:wrap; }
.staff-enrollment h2 { margin:0; font-size:clamp(23px,3vw,30px); }
.staff-enrollment label { margin:16px 0 5px; }
.staff-enrollment input { width:100%; max-width:480px; box-sizing:border-box; border:1px solid var(--line); border-radius:8px; padding:10px 12px; }
.staff-enrollment ul { list-style:none; max-height:325px; overflow:auto; margin:0; padding:0 4px 0 0; }
.staff-enrollment li { border-top:1px solid var(--line); padding:9px 0; }
.staff-enrollment li div { min-width:0; overflow-wrap:anywhere; }
.staff-enrollment li div>* { display:block; }
.staff-enrollment li small { color:#59645e; }
.staff-enrollment .secondary { flex:none; padding:7px 12px; }
.enrollment-role { flex:none; color:#58665f; font-size:14px; }
.staff-enrollment [role=status]:empty { margin:0; }

.employee-page { min-height:100vh; min-height:100dvh; display:flex; flex-direction:column; }
.employee-header { width:100%; max-width:none; margin:0; padding:12px clamp(16px,4vw,56px); background:#fff; }
.employee-header > a { display:flex; }
.employee-header img { width:123px; height:36px; object-position:left center; }
.employee-account { position:relative; z-index:3; }
.employee-account summary, .chat-launcher { display:inline-flex; align-items:center; cursor:pointer; }
.employee-account summary { gap:8px; min-height:36px; padding:4px 12px 4px 6px; list-style:none; font-size:13px; font-weight:600; background:#fff; border:1px solid var(--line); border-radius:24px; }
.employee-account summary::-webkit-details-marker { display:none; }
.account-icon { width:25px; height:25px; position:relative; overflow:hidden; border-radius:50%; background:#f1ede4; color:var(--gold); }
.account-icon::before, .account-icon::after { content:""; position:absolute; left:50%; transform:translateX(-50%); border:1.5px solid currentColor; }
.account-icon::before { width:5px; height:5px; border-radius:50%; top:5px; }
.account-icon::after { width:12px; height:6px; border-radius:9px 9px 3px 3px; top:13px; }
.account-chevron { width:6px; height:6px; border:solid currentColor; border-width:0 1.5px 1.5px 0; transform:translateY(-1px) rotate(45deg); margin-left:3px; }
.employee-account[open] .account-chevron { transform:translateY(2px) rotate(225deg); }
.account-menu { position:absolute; top:calc(100% + 7px); right:0; width:max-content; min-width:180px; max-width:min(285px,calc(100vw - 32px)); padding:8px; background:white; border:1px solid var(--line); border-radius:12px; box-shadow:0 8px 28px #15263019; font-size:13px; }
.account-menu p { margin:0 0 4px; padding:6px 8px 10px; border-bottom:1px solid var(--line); color:#52615f; overflow-wrap:anywhere; }
.account-menu p:empty { display:none; }
.account-menu a, .account-menu button { display:block; width:100%; border:0; border-radius:6px; background:none; padding:6px 8px; color:inherit; font:inherit; text-align:left; cursor:pointer; }
.account-menu a:hover, .account-menu button:hover { background:var(--paper); }
.visually-hidden { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; border:0; }
.employee-shell { position:relative; width:100%; flex:1; max-width:1040px; margin:clamp(20px,4vw,42px) auto; }
.employee-loader {
  position:absolute; inset:0; z-index:1; display:grid; place-items:center;
  visibility:hidden; opacity:0; pointer-events:none; background:var(--paper);
}
.employee-loader img { display:block; width:clamp(10rem,22vw,14rem); max-width:85%; height:auto; }
.employee-opening .employee-loader { visibility:visible; opacity:1; }
.employee-opening .employee-shell > :not(.employee-loader):not(h1) { display:none; }
@media (prefers-reduced-motion:no-preference) {
  .employee-loader { transition:opacity 160ms ease-out, visibility 0s linear 160ms; }
  .employee-opening .employee-loader { transition:none; }
  .employee-opening .employee-loader img { animation:employee-logo-pulse 1.8s ease-in-out infinite; }
  @keyframes employee-logo-pulse {
    0%,100% { opacity:1; transform:scale(1); }
    50% { opacity:.68; transform:scale(.985); }
  }
}
.employee-page .portal-foot { margin:0 auto; width:100%; max-width:1040px; padding-bottom:84px; }
.staff-directory, .employee-entry, .chat-admin { border:1px solid var(--line); background:#fff; border-radius:14px; }
.employee-entry, .staff-directory, .chat-admin { padding:clamp(16px,3vw,28px); }
.employee-entry { max-width:480px; }
.employee-entry h2 { font-size:24px; margin:0; }
.employee-entry .primary, .employee-entry .secondary { padding:7px 14px; }
.chat-admin { margin-top:16px; }
.staff-directory { display:grid; grid-template-columns:minmax(0,1fr) minmax(150px,240px); align-items:center; gap:14px; }
.staff-directory header { display:flex; align-items:center; gap:9px; }
.staff-directory h2 { font-size:clamp(24px,3vw,32px); margin:0; }
.staff-count { padding:1px 8px; border-radius:14px; background:#f2eee6; color:#685539; font:600 12px/1.7 Arial,sans-serif; }
.staff-directory input, .chat-picker input { background:#fff; padding:8px 11px; border:1px solid var(--line); border-radius:8px; font-size:14px; }
.staff-directory ul { grid-column:1/-1; max-height:min(55vh,530px); overflow:auto; margin:0; padding:0; list-style:none; }
.staff-directory li { display:flex; align-items:center; gap:12px; padding:10px 0; border-top:1px solid var(--line); }
.staff-directory li div { flex:1; min-width:0; overflow-wrap:anywhere; }
.staff-directory li strong, .staff-directory li small { display:block; }
.staff-directory li strong { font-size:14px; }
.staff-directory li small, .contact-meta { color:#59645e; font-size:12px; }
.staff-directory .staff-message { padding:5px 12px; border-radius:8px; font-size:13px; }
.staff-directory .staff-unread { color:#815824; font-weight:700; }
#staff-no-match { grid-column:1/-1; margin:0; }
.staff-avatar { flex:none; display:grid; place-items:center; width:32px; height:32px; border-radius:50%; background:#eee9df; color:#675332; font:600 12px/1 Arial,sans-serif; }
@media (max-width:550px) { .staff-directory { grid-template-columns:1fr; gap:12px; } }

.chat-dock { --dock-edge:clamp(10px,2vw,24px); --dock-bottom:max(var(--dock-edge),env(safe-area-inset-bottom)); position:fixed; z-index:20; right:max(var(--dock-edge),env(safe-area-inset-right)); bottom:var(--dock-bottom); width:max-content; max-width:calc(100% - max(var(--dock-edge),env(safe-area-inset-right)) - var(--dock-edge)); }
.chat-dock svg { width:19px; height:19px; fill:none; stroke:currentColor; stroke-linecap:round; stroke-linejoin:round; stroke-width:1.7; flex:none; }
.chat-launcher { gap:8px; min-height:42px; padding:8px 16px; color:white; background:var(--ink); border:1px solid #2b414c; border-radius:24px; font:600 14px/1.3 Arial,sans-serif; box-shadow:0 3px 14px #15263036; }
.chat-launcher:hover, #chat-send:hover { background:#29434e; }
.chat-unread { padding:2px 5px; min-width:18px; border-radius:12px; background:#e6d2ae; color:#2c271e; font-size:11px; }
.employee-chat { display:flex; flex-direction:column; width:354px; max-width:100%; height:min(438px,calc(100vh - 2 * var(--dock-edge))); height:min(438px,calc(100dvh - var(--dock-bottom) - var(--dock-edge))); overflow:hidden; background:#fff; border:1px solid var(--line); border-radius:16px; box-shadow:0 10px 40px #15263030,0 2px 6px #15263012; }
.chat-dock.is-wide .employee-chat { width:525px; height:min(625px,calc(100dvh - var(--dock-bottom) - var(--dock-edge))); }
.chat-head { flex:none; display:flex; align-items:center; gap:4px; padding:9px 10px; color:#fff; background:var(--ink); }
.thread-heading { flex:1; min-width:0; padding:0 4px; }
.thread-heading h2 { margin:0; font:600 15px/1.35 Arial,sans-serif; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.thread-heading p { margin:1px 0 0; font-size:11px; color:#d5dedf; }
.icon-button, #chat-send { flex:none; display:grid; place-items:center; width:32px; height:32px; border:none; padding:0; border-radius:8px; cursor:pointer; }
.icon-button { background:transparent; color:inherit; }
.icon-button:hover { background:#ffffff20; }
.icon-button:focus-visible, #team-chat-heading:focus-visible { outline:2px solid #e6d2ae; outline-offset:1px; }
#chat-resize .restore-icon, .is-wide #chat-resize .expand-icon { display:none; }
.is-wide #chat-resize .restore-icon { display:inline; }
.chat-thread, .chat-body, #chat-room, .chat-picker { flex:1; min-height:0; display:flex; flex-direction:column; }
.chat-body { padding:0 14px; }
.chat-body #chat-gate-box { font-size:14px; }
#chat-older { align-self:center; margin:8px 0 0; padding:4px 10px; font-size:12px; }
.chat-history { flex:1; overflow:auto; overscroll-behavior:contain; }
#chat-empty { margin:24px 0; text-align:center; font-size:13px; }
.chat-messages { list-style:none; margin:0; padding:4px 2px; }
.chat-line { max-width:85%; width:fit-content; margin:10px 0; }
.chat-line.mine { margin-left:auto; }
.chat-byline { margin:0 0 3px; display:flex; flex-wrap:wrap; align-items:baseline; gap:2px 6px; font-size:10px; color:#59645e; }
.chat-byline strong { color:var(--ink); }
.chat-line.mine .chat-byline { justify-content:flex-end; }
.chat-bubble { margin:0; padding:7px 11px; border-radius:3px 12px 12px 12px; background:#f0ece4; white-space:pre-wrap; overflow-wrap:anywhere; font:14px/1.45 Arial,sans-serif; }
.chat-line.mine .chat-bubble { background:#203842; color:#fff; border-radius:12px 3px 12px 12px; }
.chat-compose { padding:10px; border-top:1px solid var(--line); }
.compose-row { display:flex; gap:7px; align-items:center; }
.compose-row textarea { flex:1; min-width:0; resize:none; padding:8px 10px; max-height:72px; color:var(--ink); border:1px solid var(--line); background:var(--paper); border-radius:10px; font:14px/1.4 Arial,sans-serif; }
#chat-send { color:white; background:var(--ink); border-radius:50%; width:35px; height:35px; }
#chat-send:disabled { opacity:.5; }
#chat-status { margin:4px 3px 0; font-size:11px; }
#chat-status:empty { display:none; }
.chat-picker { padding:12px; }
.chat-picker ul { margin:8px 0 0; padding:0; list-style:none; overflow:auto; }
.contact-row { width:100%; display:flex; align-items:center; gap:9px; border:none; border-radius:8px; background:transparent; padding:9px 5px; cursor:pointer; text-align:left; color:var(--ink); font:600 14px/1.4 Arial,sans-serif; }
.contact-row:hover, .contact-row:focus-visible { background:#f5f2ed; }
.contact-row > span:last-child { min-width:0; overflow-wrap:anywhere; }
.contact-meta { display:block; font-weight:400; }

.staff-enrollment .staff-row-actions { display:flex; align-items:center; justify-content:flex-end; flex-wrap:wrap; gap:7px; }
.staff-enrollment .staff-row-actions .enrollment-role { font-size:12px; }
.staff-enrollment .team-filters { display:flex; gap:8px; align-items:center; }
.staff-enrollment .team-filters label {margin:0;}
.staff-directory select,.team-filters select { box-sizing:border-box; color:var(--ink); background:white; padding:8px; border:1px solid var(--line); border-radius:6px; max-width:100%; }
#employee-edit { width:min(400px,90vw); box-sizing:border-box; border:1px solid var(--line); border-radius:12px; color:var(--ink); padding:24px; }
#employee-edit::backdrop { background:rgb(17 33 40 / .55); }
#employee-edit h3 { margin:0; overflow-wrap:anywhere; }
.staff-edit-actions { display:flex; flex-wrap:wrap; gap:8px; }
.chat-email-options { border-top:1px solid var(--line); padding:14px 20px; }
.chat-email-options label { display:flex; align-items:center; gap:8px; margin:0; font-size:14px; }
.chat-email-options input { width:auto; margin:0; }
.chat-email-options span { font-size:13px; }
@media(max-width:600px) { .staff-enrollment li { align-items:flex-start; flex-wrap:wrap; } }

.directory-filters { min-width:0; display:flex; align-items:center; gap:8px; }
.directory-filters > input, .directory-filters > select { min-width:0; flex:1 1 0; }
.staff-directory { grid-template-columns:minmax(0,1fr) minmax(260px,410px); }
.account-menu .chat-email-options { margin:0 0 4px; padding:8px; border:0; border-bottom:1px solid var(--line); }
.account-menu .chat-email-options label { font-size:13px; }
@media (max-width:650px) { .staff-directory { grid-template-columns:1fr; } }

.department-chats { grid-column:1/-1; display:flex; align-items:center; flex-wrap:wrap; gap:8px 14px; border-top:1px solid var(--line); padding-top:14px; }
.department-chats > span { font-size:13px; font-weight:600; }
.department-chats > div { display:flex; gap:6px; flex-wrap:wrap; }
.department-chats button { padding:5px 12px; border-radius:20px; background:#faf8f4; font-size:13px; }
.department-chats button:hover { background:#f0ece4; }

@media (prefers-reduced-motion:no-preference) {
  @keyframes dock-in { from { opacity:.65; transform:translateY(8px) scale(.985); } to { opacity:1; transform:none; } }
  .employee-chat:not([hidden]), .chat-launcher:not([hidden]) { transform-origin:bottom right; animation:dock-in 170ms ease-out; }
  .chat-line.new, .chat-picker:not([hidden]), .account-menu, #employee-edit[open] { animation:portal-enter 150ms ease-out; }
  .staff-directory:not([hidden]) { animation:portal-enter 160ms ease-out; }
}

.chat-bubble .chat-lead-link { color:inherit; font-weight:700; text-decoration:underline; text-underline-offset:.16em; }
.chat-bubble .chat-lead-link:focus-visible { outline:2px solid currentColor; outline-offset:2px; }

/* Employee messenger */
.employee-chat{width:min(430px,calc(100vw - 28px));height:min(640px,calc(100dvh - 40px));font-family:Inter,Arial,sans-serif}
.chat-head{min-height:54px;background:#1c3541;padding-inline:14px}.chat-head h2{font-size:16px}
.chat-body{background:#f5f6f4}.chat-history{scrollbar-gutter:stable}
.chat-line{max-width:88%}.chat-bubble{background:white;box-shadow:0 1px 2px #15263013;padding:9px 12px}
.chat-line.mine .chat-bubble{background:#234551}.chat-line.mine .msg-mention{color:#f6dcac}
.msg-sidebar{display:none}.contact-row{min-height:55px;border-radius:8px;padding:9px;gap:10px}.msg-selected{background:#ecf2f2}
.contact-meta{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.msg-unread .contact-meta,.msg-mention{color:#266273;font-weight:700}
.msg-actions{display:flex;align-items:center;gap:4px;margin:1px 3px}.chat-line.mine .msg-actions{justify-content:flex-end}
.msg-actions button,.msg-tool{border:0;background:transparent;color:#466371;cursor:pointer;display:grid;place-items:center}
.msg-actions button{min-width:28px;height:25px;border-radius:6px}.msg-actions svg{width:14px;height:14px}
.msg-actions button:hover,.msg-tool:hover{background:#e4ebeb}.msg-read{font:600 12px/1 Arial;color:#416f7d;letter-spacing:-2px}
.msg-quote,.msg-media,.msg-pins button,.msg-context button,.msg-mentions button{font:inherit;cursor:pointer}
.msg-quote{display:block;max-width:100%;overflow:hidden;text-overflow:ellipsis;text-align:left;white-space:nowrap;border:0;border-left:3px solid #688994;border-radius:4px;background:#e6eeee;color:#214752;padding:5px 8px;font-size:12px}
.msg-media{display:block;padding:6px 2px;color:inherit;background:none;border:0;text-decoration:underline;text-align:left;overflow-wrap:anywhere}
.msg-pins{display:flex;gap:8px;align-items:center;padding:8px 12px;border-bottom:1px solid #d9e1e0;background:#f4f8f7}
.msg-pins button{border:0;background:none;color:#22515d;font-weight:600;font-size:12px;text-align:left}.msg-pin-first{flex:1;min-width:0;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}
.msg-tool{width:32px;height:36px;flex:none;border-radius:8px}.msg-sidebar input,.msg-search-form input,.msg-search-form select{font:inherit;border:1px solid #cbd6d6;border-radius:8px;padding:9px;min-width:0}
.msg-context,.msg-mentions{display:flex;flex-wrap:wrap;align-items:center;gap:5px;padding:4px 2px 8px;font-size:12px;color:#2b5260}
.msg-context span{flex:1 1 50%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.msg-context button,.msg-mentions button{background:#eaf1f0;color:#284952;padding:5px 7px;border:0;border-radius:6px}
.msg-mentions .selected{outline:2px solid #266273}.msg-typing:not(:empty){font-size:12px;color:#385f6a;margin:0;padding:4px 14px;background:#f5f6f4}
.msg-typing:empty,.msg-outgoing:empty{display:none}.msg-outgoing{border-radius:10px;background:#edf3f3;color:#365864;padding:8px 11px;margin:6px 2px 8px auto;font-size:13px;max-width:82%;width:fit-content;overflow-wrap:anywhere}
.msg-dialog{width:min(460px,calc(100vw - 28px));max-height:85dvh;box-sizing:border-box;border:1px solid #ccd6d5;border-radius:15px;padding:20px;color:#1b3540;background:white;box-shadow:0 12px 50px #16303a33}
.msg-dialog::backdrop{background:#10232d70}.msg-dialog h3{margin:0 0 12px}.msg-dialog button,.msg-dialog select{cursor:pointer}.msg-dialog button{border:1px solid #cbd6d6;background:#f4f7f6;color:#1e3b44;padding:7px 10px;border-radius:7px;margin:3px 3px 3px 0}
.msg-dialog img,.msg-dialog audio{display:block;max-width:100%;margin:10px auto}.msg-dialog img{max-height:60dvh;object-fit:contain}.msg-dialog a{display:inline-block;margin:8px 0}.msg-dialog>button{margin-top:15px}.msg-search-form{display:grid;grid-template-columns:1fr auto;gap:6px}.msg-search-form input{grid-column:1/-1}.msg-results button{display:block;width:100%;text-align:left;overflow-wrap:anywhere}.msg-detail-text{white-space:pre-wrap;overflow-wrap:anywhere}
@media(min-width:780px){.chat-dock.is-wide .employee-chat{display:grid;width:min(880px,calc(100vw - 48px));height:min(710px,calc(100dvh - 48px));grid-template: auto minmax(0,1fr)/ minmax(195px,30%) minmax(0,1fr)}
.is-wide .msg-sidebar{grid-area:1/1/3/2;display:flex;flex-direction:column;min-height:0;min-width:0;border-right:1px solid #d7dedd;background:#fff;padding:16px 10px 8px}
.msg-sidebar h2{font-size:21px;margin:0 8px 13px}.msg-sidebar input{font-size:13px;margin:0 4px}.msg-sidebar ul{padding:0;list-style:none;overflow:auto}
.is-wide .chat-head{grid-area:1/2/2/3}.is-wide .chat-thread,.is-wide .chat-picker{grid-area:2/2/3/3}.is-wide #chat-conversations{display:none}}
@media(max-width:600px){.chat-dock:has(.employee-chat:not([hidden])){inset:0;max-width:none;width:100%;bottom:0}
.chat-dock .employee-chat,.chat-dock.is-wide .employee-chat{width:100%;max-width:none;height:100dvh;max-height:none;border:0;border-radius:0}
.chat-head{padding-top:max(8px,env(safe-area-inset-top))}.chat-compose{padding-bottom:max(9px,env(safe-area-inset-bottom))}.chat-picker{padding-bottom:max(12px,env(safe-area-inset-bottom))}.chat-head #chat-resize{display:none}
.msg-actions button{min-width:34px;height:29px}.compose-row{gap:3px}.compose-row textarea{font-size:16px}.msg-tool{width:35px}}
