/* v3.7.0 unified-customer-service-widget — single dialog prototype */

#dify-chatbot-bubble-button,
#dify-chatbot-bubble-window {
  display: none !important;
  pointer-events: none !important;
}

body.proto-unified-cs-on [class*="customer-service-ticket-content"] {
  display: none !important;
}

.proto-unified-cs-fab {
  position: fixed;
  z-index: 10040;
  right: 16px;
  bottom: 24px;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  background: linear-gradient(135deg, #ffd700 0%, #ffb800 100%);
  box-shadow: 0 8px 24px rgba(255, 184, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
  overflow: visible;
}

.proto-unified-cs-fab:hover {
  transform: scale(1.04);
}

.proto-unified-cs-fab img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.proto-unified-cs-fab__dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff4d4f;
  border: 2px solid #1a1a1a;
}

.proto-unified-cs-panel {
  position: fixed;
  z-index: 10045;
  right: 16px;
  bottom: 92px;
  width: min(440px, calc(100vw - 32px));
  max-height: min(640px, calc(100vh - 120px));
  display: none;
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
  background: #141414;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  color: rgba(255, 255, 255, 0.88);
}

.proto-unified-cs-panel.is-open {
  display: flex;
}

@media (max-width: 1023px) {
  .proto-unified-cs-panel {
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 85vh;
    border-radius: 12px 12px 0 0;
  }

  .proto-unified-cs-fab {
    bottom: 16px;
    right: 12px;
  }
}

.proto-unified-cs-panel__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: #1a1a1a;
}

.proto-unified-cs-panel__title {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
}

.proto-unified-cs-panel__mode-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 215, 0, 0.15);
  color: #ffd700;
}

.proto-unified-cs-panel__close {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.65);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 4px;
}

.proto-unified-cs-panel__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: #171717;
}

.proto-unified-cs-panel__btn {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.88);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  position: relative;
}

.proto-unified-cs-panel__btn-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff4d4f;
  border: 1px solid #171717;
  display: none;
}

.proto-unified-cs-panel__btn.is-primary {
  border-color: #ffd700;
  color: #ffd700;
}

.proto-unified-cs-panel__btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.proto-unified-cs-panel__body {
  flex: 1;
  min-height: 320px;
  max-height: 460px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.proto-unified-cs-chat,
.proto-unified-cs-history {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.proto-unified-cs-smart__meta {
  padding: 6px 12px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.proto-unified-cs-smart__messages,
.proto-unified-cs-history {
  flex: 1;
  overflow-y: auto;
}

.proto-unified-cs-smart__messages {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.proto-unified-cs-msg {
  max-width: 88%;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

.proto-unified-cs-msg--user {
  align-self: flex-end;
  background: rgba(255, 215, 0, 0.18);
  color: #fff;
}

.proto-unified-cs-msg--agent {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.08);
}

.proto-unified-cs-msg--manual {
  border-left: 2px solid #52c41a;
}

.proto-unified-cs-msg--system {
  align-self: center;
  max-width: 96%;
  opacity: 0.9;
  font-size: 12px;
  text-align: center;
  border: 1px dashed rgba(255, 215, 0, 0.35);
  background: rgba(255, 215, 0, 0.06);
  color: rgba(255, 255, 255, 0.75);
}

.proto-unified-cs-msg--readonly {
  max-width: 100%;
}

.proto-unified-cs-smart__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px 0;
}

.proto-unified-cs-chip {
  border: 1px solid rgba(255, 215, 0, 0.35);
  background: rgba(255, 215, 0, 0.08);
  color: #ffd700;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
}

.proto-unified-cs-smart__input-row {
  display: flex;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.proto-unified-cs-smart__input {
  flex: 1;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  resize: none;
  min-height: 36px;
  max-height: 72px;
}

.proto-unified-cs-smart__send {
  border: none;
  background: #ffd700;
  color: #141414;
  border-radius: 8px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.proto-unified-cs-records__empty {
  text-align: center;
  color: rgba(255, 255, 255, 0.45);
  padding: 32px 12px;
  font-size: 13px;
}

.proto-unified-cs-records__row {
  position: relative;
  width: calc(100% - 24px);
  margin: 0 12px 8px;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
}

.proto-unified-cs-records__row--unread {
  border-color: rgba(255, 77, 79, 0.35);
  background: rgba(255, 77, 79, 0.06);
}

.proto-unified-cs-records__unread-dot {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff4d4f;
  box-shadow: 0 0 0 2px #141414;
}

.proto-unified-cs-records__row small {
  display: block;
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.45);
}

.proto-unified-cs-history__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.proto-unified-cs-history__tag {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  background: rgba(255, 215, 0, 0.15);
  color: #ffd700;
}

.proto-unified-cs-history__detail {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.proto-unified-cs-smart__chips--inline {
  padding: 0 12px 8px;
}

.proto-unified-cs-manual-guide {
  padding: 4px 12px 8px;
}

.proto-unified-cs-toast {
  position: fixed;
  z-index: 10100;
  left: 50%;
  bottom: 120px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  max-width: 90vw;
  pointer-events: none;
}
