:root {
  --dcb-font: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  --dcb-ink: #eef7ff;
  --dcb-muted: #91b8dc;
  --dcb-soft: rgba(51, 137, 224, 0.14);
  --dcb-panel: rgba(5, 24, 58, 0.94);
  --dcb-panel-2: rgba(8, 37, 82, 0.9);
  --dcb-line: rgba(74, 177, 255, 0.38);
  --dcb-line-strong: rgba(112, 205, 255, 0.72);
  --dcb-primary: #20b8ff;
  --dcb-primary-2: #0a7fe8;
  --dcb-accent: #f2d77b;
  --dcb-danger: #ff6476;
  --dcb-ok: #42f2ba;
  --dcb-shadow: 0 18px 54px rgba(0, 8, 28, 0.56), 0 0 26px rgba(24, 151, 255, 0.24);
}

:host {
  --dcb-font: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  --dcb-ink: #eef7ff;
  --dcb-muted: #91b8dc;
  --dcb-soft: rgba(51, 137, 224, 0.14);
  --dcb-panel: rgba(5, 24, 58, 0.94);
  --dcb-panel-2: rgba(8, 37, 82, 0.9);
  --dcb-line: rgba(74, 177, 255, 0.38);
  --dcb-line-strong: rgba(112, 205, 255, 0.72);
  --dcb-primary: #20b8ff;
  --dcb-primary-2: #0a7fe8;
  --dcb-accent: #f2d77b;
  --dcb-danger: #ff6476;
  --dcb-ok: #42f2ba;
  --dcb-shadow: 0 18px 54px rgba(0, 8, 28, 0.56), 0 0 26px rgba(24, 151, 255, 0.24);
}

.dcb-widget,
.dcb-widget *,
.dcb-widget *::before,
.dcb-widget *::after {
  box-sizing: border-box;
}

.dcb-widget {
  position: fixed;
  right: 28px;
  bottom: 28px;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  z-index: 2147483000;
  font-family: var(--dcb-font);
  color: var(--dcb-ink);
  line-height: 1.5;
  text-align: left;
  isolation: isolate;
  pointer-events: auto;
}

.dcb-widget button,
.dcb-widget input,
.dcb-widget textarea {
  font: inherit;
  margin: 0;
}

.dcb-widget button {
  appearance: none;
  text-transform: none;
}

.dcb-widget svg {
  display: block;
  flex: 0 0 auto;
}

.dcb-widget.dcb-left {
  right: auto;
  left: 28px;
}

.dcb-launcher {
  position: relative;
  width: 68px;
  height: 68px;
  border: 1px solid rgba(95, 204, 255, 0.74);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(29, 141, 255, 0.45), rgba(3, 32, 86, 0.92)),
    radial-gradient(circle at 50% 24%, rgba(145, 222, 255, 0.68), transparent 58%);
  box-shadow: 0 0 0 1px rgba(27, 102, 181, 0.58) inset, 0 0 28px rgba(29, 151, 255, 0.44);
  color: #bcecff;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.dcb-launcher::before,
.dcb-launcher::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 3px;
  background: rgba(105, 215, 255, 0.82);
  filter: drop-shadow(0 0 8px rgba(105, 215, 255, 0.8));
}

.dcb-launcher::before {
  top: -1px;
  left: 9px;
}

.dcb-launcher::after {
  right: 9px;
  bottom: -1px;
}

.dcb-launcher:hover {
  transform: translateY(-2px);
  border-color: rgba(177, 236, 255, 0.96);
  box-shadow: 0 0 0 1px rgba(75, 193, 255, 0.74) inset, 0 0 34px rgba(32, 184, 255, 0.58);
}

.dcb-launcher:focus-visible,
.dcb-icon-btn:focus-visible,
.dcb-primary-btn:focus-visible,
.dcb-chip:focus-visible,
.dcb-input:focus,
.dcb-textarea:focus {
  outline: 2px solid rgba(242, 215, 123, 0.76);
  outline-offset: 2px;
}

.dcb-bot-face {
  width: 42px;
  height: 42px;
  display: block;
}

.dcb-bot-face .dcb-eye {
  animation: dcb-blink 4.5s infinite;
  transform-origin: center;
}

@keyframes dcb-blink {
  0%, 92%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(0.12); }
}

.dcb-panel {
  position: relative;
  width: min(500px, calc(100vw - 36px));
  height: min(740px, calc(100vh - 46px));
  min-height: 560px;
  display: none;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  border: 1px solid var(--dcb-line-strong);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(10, 49, 104, 0.96), rgba(3, 18, 47, 0.96)),
    radial-gradient(circle at 50% 0%, rgba(33, 149, 255, 0.24), transparent 54%);
  box-shadow: var(--dcb-shadow);
  backdrop-filter: blur(12px);
}

.dcb-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent, rgba(83, 197, 255, 0.12), transparent) 0 0 / 100% 1px no-repeat,
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.025) 1px, transparent 1px, transparent 8px);
}

.dcb-widget.dcb-open .dcb-panel {
  display: grid;
}

.dcb-widget.dcb-open .dcb-launcher {
  display: none;
}

.dcb-header {
  min-height: 76px;
  padding: 13px 14px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(78, 180, 255, 0.34);
  background:
    linear-gradient(90deg, rgba(7, 52, 116, 0.82), rgba(6, 30, 73, 0.78)),
    linear-gradient(180deg, rgba(104, 197, 255, 0.12), transparent);
}

.dcb-avatar {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid rgba(95, 204, 255, 0.58);
  border-radius: 8px;
  background: rgba(28, 126, 225, 0.2);
  color: #aeefff;
  box-shadow: 0 0 18px rgba(32, 184, 255, 0.28) inset;
}

.dcb-title-wrap {
  min-width: 0;
  flex: 1;
}

.dcb-title {
  font-size: 17px;
  font-weight: 800;
  line-height: 1.2;
  color: #ffffff;
  text-shadow: 0 0 12px rgba(87, 198, 255, 0.58);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dcb-status {
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--dcb-muted);
}

.dcb-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dcb-ok);
  box-shadow: 0 0 10px rgba(66, 242, 186, 0.88);
}

.dcb-status-dot.dcb-warn {
  background: var(--dcb-accent);
  box-shadow: 0 0 10px rgba(242, 215, 123, 0.8);
}

.dcb-header-actions,
.dcb-toolbar,
.dcb-sendbar-actions,
.dcb-message-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.dcb-icon-btn {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid rgba(82, 179, 255, 0.32);
  border-radius: 6px;
  background: rgba(12, 52, 111, 0.52);
  color: #b8e9ff;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.dcb-icon-btn:hover,
.dcb-icon-btn.dcb-active {
  border-color: rgba(125, 220, 255, 0.78);
  background: rgba(21, 122, 214, 0.52);
  color: #ffffff;
  box-shadow: 0 0 14px rgba(33, 171, 255, 0.24);
}

.dcb-icon-btn[disabled] {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: none;
}

.dcb-body {
  min-height: 0;
  display: grid;
  grid-template-columns: 0 1fr;
  background: rgba(3, 17, 45, 0.55);
  transition: grid-template-columns 180ms ease;
}

.dcb-widget.dcb-history-open .dcb-body {
  grid-template-columns: 176px 1fr;
}

.dcb-sidebar {
  min-width: 0;
  overflow: hidden;
  border-right: 1px solid rgba(74, 177, 255, 0.28);
  background: rgba(4, 24, 58, 0.72);
}

.dcb-widget.dcb-history-open .dcb-sidebar {
  overflow: auto;
}

.dcb-sidebar-inner {
  width: 176px;
  padding: 10px;
}

.dcb-sidebar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.dcb-sidebar-title {
  font-size: 12px;
  color: #b9ddff;
  font-weight: 800;
}

.dcb-conversation-list {
  display: grid;
  gap: 7px;
}

.dcb-conversation-item {
  width: 100%;
  padding: 8px;
  border: 1px solid rgba(75, 167, 255, 0.3);
  border-radius: 6px;
  background: rgba(12, 51, 109, 0.54);
  color: var(--dcb-ink);
  cursor: pointer;
  text-align: left;
}

.dcb-conversation-item:hover,
.dcb-conversation-item.dcb-active {
  border-color: rgba(125, 220, 255, 0.76);
  background: rgba(22, 100, 186, 0.52);
}

.dcb-conversation-name,
.dcb-conversation-date {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dcb-conversation-name {
  font-size: 12px;
  font-weight: 800;
}

.dcb-conversation-date {
  margin-top: 4px;
  font-size: 11px;
  color: var(--dcb-muted);
}

.dcb-chat {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.dcb-toolbar {
  min-height: 48px;
  padding: 8px 12px;
  overflow-x: auto;
  border-bottom: 1px solid rgba(74, 177, 255, 0.28);
  background: rgba(5, 30, 70, 0.68);
}

.dcb-chip {
  min-height: 31px;
  padding: 6px 10px;
  border: 1px solid rgba(92, 185, 255, 0.34);
  border-radius: 6px;
  background: rgba(10, 50, 110, 0.62);
  color: #c7eaff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.dcb-chip:hover,
.dcb-chip.dcb-active {
  color: #ffffff;
  border-color: rgba(137, 222, 255, 0.8);
  background: rgba(20, 112, 204, 0.54);
}

.dcb-rate-control {
  min-height: 31px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px 3px 9px;
  border: 1px solid rgba(92, 185, 255, 0.34);
  border-radius: 6px;
  background: rgba(10, 50, 110, 0.62);
  color: #c7eaff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.dcb-rate-select {
  min-height: 25px;
  border: 1px solid rgba(137, 222, 255, 0.42);
  border-radius: 4px;
  outline: none;
  background: rgba(3, 27, 67, 0.9);
  color: #ffffff;
  font: inherit;
  cursor: pointer;
}

.dcb-rate-select:focus-visible {
  border-color: rgba(137, 222, 255, 0.9);
  box-shadow: 0 0 0 2px rgba(33, 171, 255, 0.2);
}

.dcb-messages {
  min-height: 0;
  overflow-y: auto;
  padding: 16px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.dcb-messages::-webkit-scrollbar,
.dcb-sidebar::-webkit-scrollbar,
.dcb-toolbar::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.dcb-messages::-webkit-scrollbar-thumb,
.dcb-sidebar::-webkit-scrollbar-thumb,
.dcb-toolbar::-webkit-scrollbar-thumb {
  background: rgba(67, 177, 255, 0.42);
  border-radius: 999px;
}

.dcb-empty {
  margin: auto 0;
  padding: 24px 16px;
  text-align: center;
  color: var(--dcb-muted);
}

.dcb-empty-title {
  margin-bottom: 8px;
  color: #ffffff;
  font-size: 18px;
  font-weight: 850;
  text-shadow: 0 0 12px rgba(94, 202, 255, 0.52);
}

.dcb-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  justify-content: center;
}

.dcb-message {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.dcb-message.dcb-user {
  flex-direction: row-reverse;
}

.dcb-message-icon {
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid rgba(84, 187, 255, 0.48);
  border-radius: 6px;
  background: rgba(19, 93, 170, 0.34);
  color: #aeefff;
}

.dcb-user .dcb-message-icon {
  border-color: rgba(242, 215, 123, 0.58);
  background: rgba(148, 115, 31, 0.28);
  color: #ffe99f;
}

.dcb-bubble-wrap {
  max-width: min(84%, 360px);
  min-width: 0;
}

.dcb-user .dcb-bubble-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.dcb-bubble {
  padding: 10px 12px;
  border: 1px solid rgba(87, 181, 255, 0.34);
  border-radius: 7px;
  background: rgba(10, 42, 93, 0.76);
  box-shadow: 0 8px 22px rgba(0, 9, 32, 0.2);
  color: #ecf8ff;
  font-size: 14px;
  line-height: 1.62;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.dcb-user .dcb-bubble {
  border-color: rgba(44, 202, 255, 0.62);
  background: linear-gradient(135deg, rgba(13, 124, 218, 0.9), rgba(11, 79, 157, 0.92));
  color: #ffffff;
}

.dcb-message-meta {
  margin-top: 5px;
  color: rgba(145, 184, 220, 0.82);
  font-size: 11px;
}

.dcb-message-actions {
  margin-top: 6px;
}

.dcb-message-actions .dcb-icon-btn {
  width: 28px;
  height: 28px;
}

.dcb-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.dcb-file-pill {
  max-width: 230px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 7px;
  border: 1px solid rgba(126, 215, 255, 0.3);
  border-radius: 6px;
  background: rgba(30, 105, 183, 0.26);
  color: inherit;
  font-size: 12px;
}

.dcb-thinking {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dcb-thinking span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dcb-primary);
  animation: dcb-pulse 1s infinite ease-in-out;
  box-shadow: 0 0 8px rgba(32, 184, 255, 0.8);
}

.dcb-thinking span:nth-child(2) { animation-delay: 120ms; }
.dcb-thinking span:nth-child(3) { animation-delay: 240ms; }

.dcb-workflow-progress {
  margin-top: 10px;
  padding: 8px 9px;
  border: 1px solid rgba(101, 198, 255, 0.28);
  border-radius: 6px;
  background: rgba(4, 28, 67, 0.62);
  color: #c9eaff;
  font-size: 12px;
  line-height: 1.45;
}

.dcb-workflow-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #f2fbff;
  font-weight: 800;
}

.dcb-workflow-summary-dot,
.dcb-workflow-marker {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--dcb-muted);
}

.dcb-workflow-summary-dot {
  background: var(--dcb-primary);
  box-shadow: 0 0 8px rgba(32, 184, 255, 0.75);
}

.dcb-workflow-steps {
  display: grid;
  gap: 4px;
  margin-top: 7px;
}

.dcb-workflow-step {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--dcb-muted);
}

.dcb-workflow-title {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dcb-workflow-status {
  flex: 0 0 auto;
  font-size: 11px;
}

.dcb-workflow-running {
  color: #ffffff;
}

.dcb-workflow-running .dcb-workflow-marker {
  background: var(--dcb-accent);
  box-shadow: 0 0 8px rgba(242, 215, 123, 0.85);
  animation: dcb-pulse 1s infinite ease-in-out;
}

.dcb-workflow-succeeded .dcb-workflow-marker {
  background: var(--dcb-ok);
  box-shadow: 0 0 7px rgba(66, 242, 186, 0.72);
}

.dcb-workflow-failed,
.dcb-workflow-error {
  color: #ffb7b7;
}

.dcb-workflow-failed .dcb-workflow-marker,
.dcb-workflow-error .dcb-workflow-marker {
  background: #ff7b7b;
  box-shadow: 0 0 7px rgba(255, 123, 123, 0.72);
}

@keyframes dcb-pulse {
  0%, 80%, 100% { opacity: 0.28; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

.dcb-composer {
  padding: 10px;
  border-top: 1px solid rgba(74, 177, 255, 0.34);
  background: rgba(4, 28, 67, 0.88);
}

.dcb-upload-preview {
  display: none;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 8px;
}

.dcb-upload-preview.dcb-show {
  display: flex;
}

.dcb-upload-card {
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid rgba(91, 186, 255, 0.36);
  border-radius: 6px;
  background: rgba(17, 72, 143, 0.44);
  color: #d9f2ff;
  font-size: 12px;
}

.dcb-upload-card button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--dcb-danger);
  cursor: pointer;
}

.dcb-input-row {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: 7px;
  align-items: end;
}

.dcb-textarea {
  width: 100%;
  min-height: 42px;
  max-height: 116px;
  resize: none;
  padding: 10px 11px;
  border: 1px solid rgba(91, 186, 255, 0.4);
  border-radius: 6px;
  background: rgba(1, 16, 42, 0.72);
  color: #f2fbff;
  font: 14px/1.45 var(--dcb-font);
  box-shadow: 0 0 0 1px rgba(21, 92, 169, 0.22) inset;
}

.dcb-textarea::placeholder {
  color: rgba(164, 203, 235, 0.72);
}

.dcb-primary-btn {
  min-width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(106, 219, 255, 0.72);
  border-radius: 6px;
  background: linear-gradient(180deg, #1bbfff, #0866c7);
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 0 16px rgba(32, 184, 255, 0.34);
}

.dcb-primary-btn:hover {
  background: linear-gradient(180deg, #49d4ff, #0b7ce8);
}

.dcb-primary-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.dcb-toast {
  position: absolute;
  left: 14px;
  bottom: 86px;
  max-width: calc(100% - 28px);
  padding: 9px 11px;
  border: 1px solid rgba(117, 211, 255, 0.42);
  border-radius: 6px;
  background: rgba(3, 22, 55, 0.96);
  color: #ffffff;
  font-size: 12px;
  box-shadow: 0 10px 28px rgba(0, 9, 32, 0.38), 0 0 18px rgba(32, 184, 255, 0.18);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 150ms ease, transform 150ms ease;
}

.dcb-toast.dcb-show {
  opacity: 1;
  transform: translateY(0);
}

.dcb-drop {
  outline: 2px dashed rgba(94, 207, 255, 0.66);
  outline-offset: -10px;
}

.dcb-hidden {
  display: none !important;
}

@media (max-width: 540px) {
  .dcb-widget {
    right: 12px;
    bottom: 12px;
  }

  .dcb-widget.dcb-left {
    left: 12px;
  }

  .dcb-panel {
    width: calc(100vw - 24px);
    height: calc(100vh - 24px);
    min-height: 0;
  }

  .dcb-widget.dcb-history-open .dcb-body {
    grid-template-columns: 144px 1fr;
  }

  .dcb-sidebar-inner {
    width: 144px;
  }

  .dcb-bubble-wrap {
    max-width: 88%;
  }

  .dcb-header {
    padding: 12px 10px;
  }

  .dcb-title {
    font-size: 15px;
  }

  .dcb-toolbar {
    padding: 7px 9px;
  }
}
