/* Scoped UI surfaces only. Role-motion, message data and other modules stay untouched. */
.teamchat-view {
  --chat-ui-accent: #117c77;
  --chat-ui-border: #c6dddf;
  --chat-ui-muted: #58747d;
  --chat-ui-hover: #e5f3f1;
}
/* One role-tinted speech bubble, including reply context. No change to role-motion effects. */
.teamchat-view .teamchat-message { --chat-bubble-background: #edf7f5; --chat-bubble-border: #c5e1dd; }
.teamchat-view .teamchat-message.is-developer { --chat-bubble-background: #f4edff; --chat-bubble-border: #ddc9ff; }
.teamchat-view .teamchat-message.is-superadmin { --chat-bubble-background: #fff4e6; --chat-bubble-border: #f5d6b2; }
.teamchat-view .teamchat-message.is-admin { --chat-bubble-background: #edf4ff; --chat-bubble-border: #c7d9fc; }
.teamchat-view .teamchat-message-bubble {
  position: relative;
  box-sizing: border-box;
  width: fit-content;
  max-width: 100%;
  margin: 2px 0 10px;
  padding: 8px 12px;
  border: 1px solid var(--chat-bubble-border);
  border-radius: 12px;
  background: var(--chat-bubble-background);
  color: #173540;
  overflow-wrap: anywhere;
}
.teamchat-view .teamchat-message-bubble::before {
  content: "";
  position: absolute;
  pointer-events: none;
  left: -5px;
  top: 8px;
  width: 9px;
  height: 9px;
  border-left: 1px solid var(--chat-bubble-border);
  border-bottom: 1px solid var(--chat-bubble-border);
  background: var(--chat-bubble-background);
  transform: rotate(45deg);
}
.teamchat-view .teamchat-message-bubble > .teamchat-text { margin: 8px 0 0; color: #173540; }
.teamchat-view .teamchat-message-bubble > .teamchat-text:first-of-type { margin-top: 0; }
.teamchat-view .teamchat-message-bubble > .teamchat-translation { margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; }
.teamchat-view .teamchat-message-bubble > .teamchat-translation .teamchat-text { margin: 5px 0 0; color: #173540; }
.teamchat-view .teamchat-message-content { min-width: 0; }
/* Keep 40px action targets, without letting them push the text far below its author. */
body.launcher-webstyle .teamchat-view .teamchat-message.has-message-bubble .teamchat-message-head { min-height: 24px; padding-right: 42px; }
body.launcher-webstyle .teamchat-view .teamchat-message.has-message-bubble .teamchat-message-head:has(.teamchat-reaction-add) { padding-right: 80px; }
body.launcher-webstyle .teamchat-view .teamchat-message.has-message-bubble .teamchat-message-menu { position: absolute; right: 0; top: -8px; }
body.launcher-webstyle .teamchat-view .teamchat-message.has-message-bubble .teamchat-reaction-add { position: absolute; right: 42px; top: -4px; }
.teamchat-view .teamchat-message-bubble > .teamchat-reply-reference {
  display: grid;
  gap: 3px;
  box-sizing: border-box;
  max-width: 100%;
  margin: 0 0 8px;
  padding: 7px 10px;
  border: 1px solid #d6e1e5;
  border-left: 3px solid var(--reply-color, #117c77);
  border-radius: 8px;
  background: #fff;
  color: #4c5963;
  line-height: 1.45;
}
.teamchat-view .teamchat-message-bubble > .teamchat-reply-reference strong { font-size: 12px; font-weight: 750; }
.teamchat-view .teamchat-message-bubble > .teamchat-reply-reference span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; white-space: normal; overflow: hidden; font-size: 13px; color: #4c5963; }
.teamchat-view .teamchat-message-bubble > .teamchat-reply-reference:focus-visible { outline: 2px solid #117c77; outline-offset: 2px; }
.teamchat-view .teamchat-message.has-message-bubble .teamchat-reactions { position: relative; z-index: 1; margin: -20px 0 0 6px; }
.teamchat-view .teamchat-reactions .teamchat-reaction { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 32px; padding: 3px 9px; border-radius: 12px; }
.teamchat-view .teamchat-reaction-emoji { font: 19px/1.1 "Segoe UI Emoji", "Apple Color Emoji", sans-serif; }
.teamchat-view .teamchat-reaction-count { font: 12px/1.2 "Segoe UI", sans-serif; color: #4c5963; }
.teamchat-view dialog {
  box-sizing: border-box;
  max-width: calc(100vw - 32px);
  max-height: min(85vh, calc(100vh - 40px));
  border: 1px solid var(--chat-ui-border);
  border-radius: 20px;
  color: #173540;
  background: #fbfdfd;
  box-shadow: 0 24px 72px #12353c30, 0 4px 16px #12353c14;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  overflow: auto;
}
.teamchat-view dialog:not(.teamchat-media-dialog):not(.teamchat-preview-dialog) { padding: 24px; }
.teamchat-view dialog[open] { animation: teamchat-dialog-enter 180ms cubic-bezier(.2,.8,.2,1) both; }
.teamchat-view dialog::backdrop { background: #0e303959; }
.teamchat-view dialog > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}
.teamchat-view dialog > header :is(h3, strong) { font-size: 18px; font-weight: 750; margin: 0; line-height: 1.3; }
.teamchat-view dialog > :is(h3, h2) { margin: 0 0 12px; font-size: 18px; }
.teamchat-view dialog > p, .teamchat-dialog-hint { color: var(--chat-ui-muted); font-size: 13px; }
.teamchat-view dialog :is(input:not([type=checkbox]):not([type=radio]), textarea, select) {
  box-sizing: border-box;
  min-height: 44px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--chat-ui-border);
  border-radius: 12px;
  background: #fff;
  color: #173540;
  font: inherit;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.teamchat-view dialog :is(input, textarea, select):focus-visible {
  border-color: var(--chat-ui-accent);
  outline: 2px solid #117c7729;
  outline-offset: 2px;
}
.teamchat-view dialog button, .teamchat-view .teamchat-personal-toolbar button,
.teamchat-view .teamchat-calendar-banner button, .teamchat-view .teamchat-calendar-status button {
  box-sizing: border-box;
  min-height: 38px;
  border: 1px solid var(--chat-ui-border);
  border-radius: 11px;
  padding: 8px 13px;
  background: #fff;
  color: #176b68;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}
.teamchat-view dialog button:focus-visible, .teamchat-view .teamchat-personal-toolbar button:focus-visible,
.teamchat-view .teamchat-calendar-banner button:focus-visible, .teamchat-view .teamchat-calendar-status button:focus-visible {
  outline: 2px solid var(--chat-ui-accent);
  outline-offset: 3px;
}
@media (hover: hover) {
  .teamchat-view dialog button:hover:not(:disabled), .teamchat-view .teamchat-personal-toolbar button:hover:not(:disabled),
  .teamchat-view .teamchat-calendar-banner button:hover:not(:disabled), .teamchat-view .teamchat-calendar-status button:hover:not(:disabled) {
    background: var(--chat-ui-hover);
    border-color: #71aaa8;
    box-shadow: 0 3px 9px #117c7714;
    transform: translateY(-1px);
  }
}
.teamchat-view dialog button:active:not(:disabled), .teamchat-view .teamchat-personal-toolbar button:active:not(:disabled) { transform: translateY(0); box-shadow: none; }
.teamchat-view dialog button:disabled { opacity: .55; cursor: default; }
.teamchat-view dialog :is(button[type=submit], button.teamchat-primary-action) {
  background: var(--chat-ui-accent);
  color: #fff;
  border-color: var(--chat-ui-accent);
}
.teamchat-view dialog :is(button[type=submit], button.teamchat-primary-action):hover:not(:disabled) { background: #096c67; border-color: #096c67; }
.teamchat-view .teamchat-personal-dialog { width: min(640px, calc(100vw - 32px)); }
.teamchat-view .teamchat-personal-dialog form { padding: 12px; border-radius: 14px; background: #edf5f5; gap: 10px; }
.teamchat-view .teamchat-personal-results { margin-top: 16px; }
.teamchat-view .teamchat-personal-results > button { padding: 13px 15px; gap: 6px; border-radius: 13px; }
.teamchat-view .teamchat-personal-results > button strong { font-size: 14px; color: #173540; }
.teamchat-view .teamchat-personal-results > button small { font-size: 12px; }
.teamchat-view .teamchat-emoji-grid button { padding: 4px; font: 24px "Segoe UI Emoji", "Apple Color Emoji", sans-serif; }
.teamchat-view .teamchat-media-dialog > header { margin-bottom: 0; }
.teamchat-view .teamchat-management-dialog > header { top: -24px; background: #fbfdfd; }
body.launcher-webstyle .teamchat-compact .teamchat-day-separator {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  margin: 22px 0 14px;
  padding: 0;
  background: transparent;
  color: #526c76;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.4;
}
.teamchat-view .teamchat-day-separator::before, .teamchat-view .teamchat-day-separator::after { content: ""; height: 1px; flex: 1; background: #c6dadd; }
.teamchat-view .teamchat-day-separator > span { padding: 4px 12px; border: 1px solid #d3e3e5; border-radius: 20px; background: #f6fafb; }
.teamchat-history-tools { min-width: 0; }
.teamchat-view .teamchat-personal-toolbar { padding: 8px 12px; gap: 7px; }
.teamchat-view .teamchat-personal-toolbar button { font-size: 12px; min-height: 32px; padding: 5px 10px; }
.teamchat-view .teamchat-personal-toolbar button[data-chat-calendar][aria-pressed=true] {
  background: #117c77; color: #fff; border-color: #117c77;
  /* Set the contrasting selected surface immediately, without white text on a fading white button. */
  transition: box-shadow 150ms ease, transform 150ms ease;
}
@media (hover: hover) {
  .teamchat-view .teamchat-personal-toolbar button[data-chat-calendar][aria-pressed=true]:hover:not(:disabled) { background: #096c67; color: #fff; border-color: #096c67; }
}
.teamchat-calendar-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 14px; margin: 0 0 8px; border: 1px solid #8ebebb; border-left: 3px solid #117c77; border-radius: 12px; background: #e5f3f1; }
.teamchat-calendar-banner strong, .teamchat-calendar-banner > span { flex-basis: 100%; }
.teamchat-calendar-banner strong { font-size: 13px; }
.teamchat-calendar-banner > span { font-size: 12px; color: #45646c; }
.teamchat-view .teamchat-calendar-banner button { padding: 5px 10px; min-height: 32px; font-size: 12px; }
.teamchat-calendar-dialog { width: min(540px, calc(100vw - 32px)); }
.teamchat-calendar-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 20px; }
.teamchat-calendar-fields label { display: grid; gap: 7px; font-weight: 650; }
.teamchat-calendar-dialog footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.teamchat-calendar-dialog [role=status] { color: #b14431; font-size: 13px; }
.teamchat-calendar-status { text-align: center; padding: 10px; color: #526c76; font-size: 13px; }
.teamchat-history-tools[hidden], .teamchat-calendar-banner[hidden] { display: none !important; }
.teamchat-view .teamchat-message-menu[open] .teamchat-message-actions,
.teamchat-view .teamchat-attachment-menu:not([hidden]), .teamchat-reaction-people { animation: teamchat-surface-enter 150ms ease both; }
.teamchat-view :is(.teamchat-message-actions, .teamchat-attachment-menu) button { transition: background-color 150ms ease, color 150ms ease, transform 150ms ease; border-radius: 8px; }
@media (hover: hover) {
  .teamchat-view :is(.teamchat-message-actions, .teamchat-attachment-menu) button:hover:not(:disabled) { transform: translateX(2px); }
}
.teamchat-view :is(.teamchat-message-actions, .teamchat-attachment-menu) button:focus-visible { outline: 2px solid var(--chat-ui-accent); outline-offset: -2px; }
@keyframes teamchat-surface-enter { from { opacity: 0; } to { opacity: 1; } }
@keyframes teamchat-dialog-enter { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@media (max-width: 480px) {
  .teamchat-view dialog:not(.teamchat-media-dialog):not(.teamchat-preview-dialog) { padding: 18px; }
  .teamchat-calendar-fields { grid-template-columns: minmax(0, 1fr); }
  .teamchat-view .teamchat-personal-dialog form { flex-wrap: wrap; }
  .teamchat-view .teamchat-personal-dialog form input { flex-basis: 100%; }
  .teamchat-view .teamchat-personal-dialog form button { margin-left: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .teamchat-view dialog[open] { animation: none; }
  .teamchat-view dialog :is(button, input, textarea, select), .teamchat-view .teamchat-personal-toolbar button,
  .teamchat-view .teamchat-personal-toolbar button[data-chat-calendar][aria-pressed=true],
  .teamchat-view .teamchat-calendar-banner button, .teamchat-view .teamchat-calendar-status button { transition: none; transform: none !important; }
  .teamchat-view .teamchat-message-menu[open] .teamchat-message-actions,
  .teamchat-view .teamchat-attachment-menu:not([hidden]), .teamchat-reaction-people { animation: none; }
  .teamchat-view :is(.teamchat-message-actions, .teamchat-attachment-menu) button { transition: none; transform: none !important; }
}
