/* Staff customer chat is isolated from the existing workspace theme. */
#shell .staff-customer-chat-trigger {
  position: fixed;
  right: 10px;
  bottom: calc(76px + env(safe-area-inset-bottom));
  z-index: 72;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 50%;
  color: #f7cf00;
  background: #1b1a1a;
  box-shadow: 0 13px 36px rgba(0, 0, 0, .55);
  cursor: pointer;
}

#shell .staff-customer-chat-trigger:hover { border-color: rgba(247, 207, 0, .55); background: #242321; }
#shell .staff-customer-chat-trigger:focus-visible,
#shell .staff-customer-chat-dialog :where(button, textarea):focus-visible { outline: 2px solid #f7cf00; outline-offset: 2px; }
#shell .staff-customer-chat-trigger svg { width: 24px; height: 24px; }
#shell .staff-customer-chat-dot {
  position: absolute;
  top: -1px;
  left: -1px;
  width: 13px;
  height: 13px;
  border: 3px solid #0a0a0a;
  border-radius: 50%;
  background: #ff4d4f;
  box-shadow: 0 0 0 1px rgba(255, 77, 79, .2);
}
#shell .staff-customer-chat-dot[hidden] { display: none; }

#shell .staff-customer-chat-dialog {
  position: fixed;
  inset: auto 8px calc(72px + env(safe-area-inset-bottom)) 8px;
  z-index: 130;
  display: flex;
  flex-direction: column;
  width: auto;
  max-width: none;
  height: min(620px, calc(100dvh - 92px - env(safe-area-inset-bottom)));
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .11);
  border-radius: 20px;
  color: #f5f2ed;
  background: #10100f;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .76);
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
#shell .staff-customer-chat-dialog:not([open]) { display: none !important; }
#shell .staff-customer-chat-dialog::backdrop { background: rgba(0, 0, 0, .56); backdrop-filter: blur(3px); }
#shell .staff-customer-chat-head {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, .075);
  background: #151514;
}
#shell .staff-customer-chat-heading { min-width: 0; flex: 1; }
#shell .staff-customer-chat-heading h2 { margin: 0; overflow: hidden; font-size: 16px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
#shell .staff-customer-chat-subtitle { display: block; margin-top: 3px; overflow: hidden; color: #8e8983; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
#shell .staff-customer-chat-back,
#shell .staff-customer-chat-close {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 11px;
  color: #eeeae4;
  background: #232321;
  font: inherit;
  cursor: pointer;
}
#shell .staff-customer-chat-back[hidden] { display: none; }
#shell .staff-customer-chat-back svg { width: 20px; height: 20px; }
#shell .staff-customer-chat-close { padding-bottom: 3px; font-size: 24px; line-height: 1; }
#shell .staff-customer-chat-body { display: flex; min-width: 0; min-height: 0; flex: 1; flex-direction: column; overflow: hidden; background: #0d0d0c; }
#shell .staff-customer-chat-error { flex: 0 0 auto; margin: 10px 10px 0; padding: 9px 10px; border: 1px solid rgba(255, 82, 82, .3); border-radius: 10px; color: #ff918d; background: rgba(255, 82, 82, .09); font-size: 11px; line-height: 1.4; }
#shell .staff-customer-chat-error[hidden],
#shell .staff-customer-chat-list[hidden],
#shell .staff-customer-chat-thread[hidden] { display: none !important; }
#shell .staff-customer-chat-list { min-width: 0; min-height: 0; padding: 10px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
#shell .staff-customer-chat-card {
  display: flex;
  width: 100%;
  min-width: 0;
  flex-direction: column;
  gap: 7px;
  margin: 0 0 8px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, .075);
  border-radius: 13px;
  color: #f0ede8;
  background: #191918;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
#shell .staff-customer-chat-card:hover { border-color: rgba(255, 255, 255, .16); background: #20201e; }
#shell .staff-customer-chat-card.is-waiting { border-color: rgba(255, 77, 79, .42); box-shadow: inset 3px 0 #ff4d4f; }
#shell .staff-customer-chat-card-top,
#shell .staff-customer-chat-meta { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 8px; }
#shell .staff-customer-chat-card-top strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
#shell .staff-customer-chat-status { flex: 0 0 auto; padding: 4px 7px; border-radius: 999px; color: #aaa49d; background: #282725; font-size: 8px; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
#shell .staff-customer-chat-status.status-waiting { color: #ffaaa7; background: rgba(255, 77, 79, .13); }
#shell .staff-customer-chat-status.status-operator { color: #f7cf00; background: rgba(247, 207, 0, .1); }
#shell .staff-customer-chat-preview { min-width: 0; overflow: hidden; color: #a39e98; font-size: 11px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
#shell .staff-customer-chat-meta { color: #696560; font-size: 9px; }
#shell .staff-customer-chat-meta b { display: grid; min-width: 19px; height: 19px; place-items: center; padding: 0 5px; border-radius: 999px; color: #fff; background: #e64245; font-size: 9px; }
#shell .staff-customer-chat-empty { display: flex; min-height: 220px; align-items: center; justify-content: center; flex-direction: column; gap: 8px; padding: 25px; color: #77726c; text-align: center; }
#shell .staff-customer-chat-empty strong { color: #d9d5cf; font-size: 13px; }
#shell .staff-customer-chat-empty span { max-width: 260px; font-size: 11px; line-height: 1.5; }

#shell .staff-customer-chat-thread { display: flex; min-width: 0; min-height: 0; flex: 1; flex-direction: column; overflow: hidden; }
#shell .staff-customer-chat-loading,
#shell .staff-customer-chat-empty-thread { margin: auto; padding: 20px; color: #77726c; font-size: 11px; text-align: center; }
#shell .staff-customer-chat-messages { min-width: 0; min-height: 0; flex: 1; padding: 13px 11px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-color: #373532 transparent; }
#shell .staff-customer-chat-message { display: flex; min-width: 0; margin: 0 0 9px; justify-content: flex-start; }
#shell .staff-customer-chat-message.role-operator { justify-content: flex-end; }
#shell .staff-customer-chat-bubble { max-width: 84%; min-width: 0; padding: 9px 10px 7px; border: 1px solid rgba(255, 255, 255, .075); border-radius: 4px 13px 13px 13px; background: #1c1c1a; }
#shell .role-operator .staff-customer-chat-bubble { border-color: rgba(247, 207, 0, .16); border-radius: 13px 4px 13px 13px; background: rgba(247, 207, 0, .09); }
#shell .role-assistant .staff-customer-chat-bubble { background: #161a1c; }
#shell .role-system .staff-customer-chat-bubble { max-width: 100%; margin: 0 auto; border: 0; color: #8b8781; background: transparent; text-align: center; }
#shell .staff-customer-chat-author { display: block; margin-bottom: 4px; color: #8e8983; font-size: 8px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
#shell .staff-customer-chat-text { overflow-wrap: anywhere; color: #eeeae4; font-size: 11.5px; line-height: 1.48; white-space: pre-wrap; }
#shell .staff-customer-chat-bubble time { display: block; margin-top: 5px; color: #66625d; font-size: 8px; text-align: right; }
#shell .staff-customer-chat-actions,
#shell .staff-customer-chat-composer,
#shell .staff-customer-chat-readonly { flex: 0 0 auto; padding: 11px; border-top: 1px solid rgba(255, 255, 255, .075); background: #151514; }
#shell .staff-customer-chat-actions p { margin: 0 0 9px; color: #8f8a84; font-size: 10px; line-height: 1.4; }
#shell .staff-customer-chat-primary,
#shell .staff-customer-chat-secondary { min-height: 39px; padding: 9px 13px; border: 0; border-radius: 11px; font: inherit; font-size: 11px; font-weight: 800; cursor: pointer; }
#shell .staff-customer-chat-primary { color: #1b1600; background: #f7cf00; }
#shell .staff-customer-chat-secondary { color: #d4d0ca; background: #282725; }
#shell .staff-customer-chat-primary:disabled,
#shell .staff-customer-chat-secondary:disabled { cursor: default; opacity: .55; }
#shell .staff-customer-chat-actions .staff-customer-chat-primary { width: 100%; }
#shell .staff-customer-chat-composer textarea { box-sizing: border-box; width: 100%; min-height: 68px; max-height: 150px; resize: vertical; padding: 10px 11px; border: 1px solid rgba(255, 255, 255, .1); border-radius: 11px; color: #f4f0ea; background: #0d0d0c; font: inherit; font-size: 12px; line-height: 1.45; }
#shell .staff-customer-chat-composer textarea::placeholder { color: #65615c; }
#shell .staff-customer-chat-composer-controls { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
#shell .staff-customer-chat-readonly { color: #98938d; font-size: 10px; line-height: 1.45; text-align: center; }

@media (min-width: 900px) {
  #shell .staff-customer-chat-trigger { right: 22px; bottom: 24px; }
  #shell .staff-customer-chat-dialog { inset: auto 28px 88px auto; width: 390px; height: min(620px, calc(100dvh - 116px)); }
}

@media (max-width: 370px) {
  #shell .staff-customer-chat-dialog { border-radius: 16px; }
  #shell .staff-customer-chat-composer-controls { display: grid; grid-template-columns: 1fr 1fr; }
}
