#chat-duty[hidden],#chat-inbox[hidden],#chat-alert[hidden],#chat-office [hidden]{display:none!important}
#chat-duty,#chat-inbox{box-sizing:border-box;height:44px;min-height:44px;display:inline-flex;align-items:center;justify-content:center;gap:4px;padding:4px 7px;white-space:nowrap;flex:none}
html[data-theme] .site-header #chat-duty[aria-pressed="true"]{background:var(--ui-primary);border-color:var(--ui-primary-border);color:var(--ui-primary-ink)}
#chat-duty[aria-pressed="true"]::before{content:"✓";font-weight:bold}
#chat-duty #chat-colleague{display:inline-grid;place-items:center;min-width:18px;height:18px;border:1px solid var(--ui-border);border-radius:50%;font-size:10px;background:var(--ui-surface);color:var(--ui-muted)}
#chat-duty #chat-colleague.chat-on{background:var(--ui-primary);border:2px solid var(--ui-primary-ink);color:var(--ui-primary-ink)}
#chat-inbox svg{width:16px;height:16px}#chat-count:empty{display:none}
#chat-office{display:grid;grid-template-columns:minmax(155px,28%) minmax(0,1fr);gap:16px;color:var(--ui-ink)}
#chat-office .chat-list,#chat-office .chat-detail,#chat-alert{box-sizing:border-box;background:var(--ui-surface);border:1px solid var(--ui-border);border-radius:12px;padding:14px}
#chat-office .chat-list{display:flex;flex-direction:column;align-self:start;gap:6px;max-height:65dvh;overflow:auto}
#chat-office .chat-list:empty{display:none}
#chat-office .chat-list:empty+.chat-detail{grid-column:1/-1}
#chat-office .chat-list button{display:grid;text-align:left;overflow-wrap:anywhere}
#chat-office .chat-list [aria-current=true]{border-color:var(--ui-accent);box-shadow:inset 3px 0 var(--ui-accent)}
#chat-office h2{margin:0;overflow-wrap:anywhere}
.chat-controls,#chat-alert>div{display:flex;flex-wrap:wrap;gap:8px}
#chat-office .chat-owner,#chat-office .chat-contact{margin:4px 0;color:var(--ui-muted);font-size:.875rem;overflow-wrap:anywhere}
#chat-office .chat-controls{margin-top:8px}
#chat-office .chat-history{
  display:flex;flex-direction:column;gap:8px;max-height:48dvh;overflow:auto;
  margin:12px 0 8px;padding:10px 2px;border-block:1px solid var(--ui-border);
}
#chat-office .chat-history:empty{display:none}
#chat-office .chat-bubble{
  align-self:flex-start;flex:none;box-sizing:border-box;max-width:min(86%,65ch);
  padding:8px 12px;background:var(--ui-surface-soft);color:var(--ui-ink);
  border-radius:16px 16px 16px 4px;line-height:1.4;overflow-wrap:anywhere;
}
#chat-office .chat-bubble strong{display:block;margin-bottom:2px;font-size:.75rem;line-height:1.25;color:inherit}
#chat-office .chat-bubble span{white-space:pre-wrap}
#chat-office .chat-bubble[data-side="outgoing"]{
  align-self:flex-end;border-radius:16px 16px 4px 16px;
  background:var(--ui-primary);color:var(--ui-primary-ink);
}
#chat-office .chat-bubble[data-side="notice"]{
  align-self:center;padding:4px 8px;background:transparent;color:var(--ui-muted);font-size:.8125rem;text-align:center;
}
#chat-office .chat-composer{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:end;gap:8px;margin:8px 0}
#chat-office .chat-composer textarea{
  box-sizing:border-box;width:100%;min-width:0;min-height:44px;max-height:110px;margin:0;
  padding:10px 12px;font:inherit;font-size:16px;line-height:22px;resize:vertical;
}
#chat-office .chat-send{min-height:44px;padding:8px 16px;background:var(--ui-primary);color:var(--ui-primary-ink);border:1px solid var(--ui-primary-border)}
#chat-office .chat-send:hover:not(:disabled){background:var(--ui-primary-hover)}
#chat-office .chat-finish{font-size:.875rem}
#chat-office [role="status"]:empty{display:none}
#chat-duty-message:empty{display:none}#chat-duty-message{font-size:.9rem;padding:4px 12px;color:var(--ui-ink)}
#chat-alert{position:fixed;inset:38% auto auto 50%;transform:translate(-50%,-50%);margin:0;width:min(360px,calc(100vw - 28px));color:var(--ui-ink);border-top:4px solid var(--ui-accent);box-shadow:var(--ui-dialog-shadow);z-index:2147483646}
#chat-alert strong{display:block;margin-bottom:12px;overflow-wrap:anywhere}
@media(max-width:600px){
  #chat-duty,#chat-inbox{padding:3px 5px}
  #chat-office{grid-template-columns:minmax(0,1fr);gap:8px}
  #chat-office .chat-list{max-height:22dvh}
  #chat-office textarea{font-size:16px}
}

#chat-office .chat-typing{display:flex;align-items:center;gap:6px;min-height:20px;margin:4px 0;font-size:13px;color:var(--ui-muted)}
#chat-office .chat-typing[hidden]{display:none}
#chat-office .typing-dots{display:inline-flex;gap:3px}
#chat-office .typing-dots i{width:4px;height:4px;border-radius:50%;background:currentColor;animation:typing-bounce 1s ease-in-out infinite}
#chat-office .typing-dots i:nth-child(2){animation-delay:.15s}#chat-office .typing-dots i:nth-child(3){animation-delay:.3s}
@keyframes typing-bounce{0%,60%,100%{transform:translateY(0)}30%{transform:translateY(-3px)}}
@media(prefers-reduced-motion:reduce){#chat-office .typing-dots i{animation:none}}

#chat-office .chat-preview{margin-block:8px;padding:10px 12px;background:var(--ui-surface-soft);border-radius:10px}
#chat-office .chat-proposal{white-space:pre-wrap;overflow-wrap:anywhere;margin:6px 0}
#chat-office .chat-links a{display:block;color:var(--ui-ink);text-decoration:underline;margin:4px 0}

#chat-office .chat-files{display:flex;align-items:end;gap:8px;flex-wrap:wrap;margin:8px 0}
#chat-office .chat-files label{display:grid;max-width:100%;font-size:.875rem}
#chat-office .chat-files input{max-width:100%}
#chat-office .chat-bubble .chat-download{color:inherit;background:transparent;font:inherit;border:0;text-decoration:underline;text-align:left;padding:4px 0;overflow-wrap:anywhere}
