.chatbox-shortcode-tip {
  margin: 14px 0;
  padding: 10px 12px;
  border: 1px dashed #dcdfe6;
  border-radius: 6px;
  color: #606266;
  background: #f5f7fa;
  font-size: 13px;
}

/* Fancybox overlay must stay above ChatBox (ChatBox uses z-index 99999). */
:root {
  --fancybox-zIndex: 1000000;
}

.fancybox__container {
  z-index: var(--fancybox-zIndex, 1050) !important;
}

.cb-root,
.cb-root * {
  box-sizing: border-box;
}

.cb-root {
  --cb-bg: #f5f7fa;
  --cb-surface: #ffffff;
  --cb-border: #dcdfe6;
  --cb-text: #303133;
  --cb-muted: #909399;
  --cb-primary: #409eff;
  --cb-danger: #f56c6c;
  --cb-control-height: 28px;
  --cb-icon-nudge-y: 1px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--cb-text);
}

.cb-toggle {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 56px;
  height: 56px;
  border: 1px solid var(--cb-border);
  border-radius: 50%;
  background: #fff;
  color: var(--cb-primary);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 99998;
}

.cb-toggle:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
}

.cb-toggle .cb-icon {
  width: 24px;
  height: 24px;
}

.cb-toggle .cb-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #f56c6c;
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  display: none;
}

.cb-panel {
  position: fixed;
  right: 18px;
  bottom: 84px;
  width: 960px;
  max-width: calc(100vw - 24px);
  height: 640px;
  max-height: calc(100vh - 120px);
  border: 1px solid var(--cb-border);
  border-radius: 8px;
  background: var(--cb-surface);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
  display: none;
  overflow: hidden;
  z-index: 99999;
}

.cb-panel.is-open {
  display: flex;
}

.cb-sidebar {
  width: 290px;
  border-right: 1px solid var(--cb-border);
  background: var(--cb-surface);
  display: flex;
  flex-direction: column;
}

.cb-side-head {
  padding: 12px;
  border-bottom: 1px solid var(--cb-border);
  background: #fff;
}

.cb-side-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cb-side-head .cb-title {
  font-size: 16px;
  font-weight: 600;
  color: #303133;
}

.cb-side-head .cb-sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--cb-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.cb-viewer-label {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cb-viewer-uid {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.04);
  color: #606266;
}

.cb-viewer-uid svg {
  width: 14px;
  height: 14px;
  display: block;
}

.cb-viewer-uid-num {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.cb-side-tools {
  margin-top: 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.cb-side-tools.cb-side-tools-top {
  flex-wrap: nowrap;
}

.cb-side-tools.cb-side-tools-top .cb-dm-tools {
  margin-left: auto;
}

.cb-dm-tools {
  display: flex;
  align-items: center;
  min-width: 0;
}

.cb-dm-tools .cb-input {
  width: 130px;
}

.cb-icon-btn {
  width: var(--cb-control-height);
  height: var(--cb-control-height);
  border: 0;
  padding: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--cb-text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  font-size: 0;
  flex: 0 0 auto;
}

.cb-root .cb-icon-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: var(--cb-control-height) !important;
  height: var(--cb-control-height) !important;
  min-height: var(--cb-control-height) !important;
  padding: 0 !important;
  line-height: 0 !important;
  border: 0 !important;
  background: transparent !important;
  margin: 0 !important;
  -webkit-appearance: none !important;
  appearance: none !important;
  vertical-align: middle !important;
  box-sizing: border-box !important;
}

.cb-root .cb-only-mobile {
  display: none !important;
}

.cb-root .cb-input-tools {
  display: flex !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
}

.cb-root .cb-search,
.cb-root .cb-side-tools {
  display: flex !important;
  align-items: center !important;
}

.cb-root .cb-icon-btn::-moz-focus-inner,
.cb-root .cb-btn::-moz-focus-inner {
  border: 0 !important;
  padding: 0 !important;
}

.cb-icon-btn:hover {
  background: #f5f7fa;
}

.cb-icon-btn:active {
  background: #ecf5ff;
}

.cb-icon-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.cb-icon-btn.danger {
  color: var(--cb-danger);
}

.cb-icon-btn.danger:hover {
  background: #fef0f0;
}

.cb-icon-btn svg {
  width: 20px;
  height: 20px;
  display: block;
  pointer-events: none;
  transform: translateY(var(--cb-icon-nudge-y));
  transform-origin: 50% 50%;
}

.cb-icon-btn.is-loading svg {
  animation: cb-spin 0.9s linear infinite;
}

@keyframes cb-spin {
  from {
    transform: translateY(var(--cb-icon-nudge-y)) rotate(0deg);
  }
  to {
    transform: translateY(var(--cb-icon-nudge-y)) rotate(360deg);
  }
}

.cb-btn {
  height: var(--cb-control-height);
  border: 1px solid var(--cb-border);
  border-radius: 4px;
  background: #fff;
  color: var(--cb-text);
  text-decoration: none;
  white-space: nowrap;
  font-size: 12px;
  padding: 0 10px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  cursor: pointer;
}

.cb-btn:hover {
  border-color: #c0c4cc;
}

.cb-btn.primary {
  border-color: var(--cb-primary);
  background: var(--cb-primary);
  color: #fff;
}

.cb-btn.primary:hover {
  opacity: 0.92;
}

.cb-btn.danger {
  border-color: #fbc4c4;
  color: var(--cb-danger);
}

.cb-list-wrap {
  flex: 1;
  overflow: auto;
  padding: 10px;
  background: #fff;
  overscroll-behavior: contain;
}

.cb-list-title {
  margin: 8px 2px;
  font-size: 11px;
  color: var(--cb-muted);
  letter-spacing: 0.04em;
}

.cb-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 4px;
  margin-bottom: 6px;
  background: #fff;
  cursor: pointer;
}

.cb-item > div:first-child {
  flex: 1 1 auto;
  min-width: 0; /* allow ellipsis inside flex items */
}

.cb-item:hover {
  background: #f5f7fa;
}

.cb-item.is-active {
  border-color: #b3d8ff;
  background: #ecf5ff;
}

.cb-item .cb-name {
  font-size: 13px;
  font-weight: 500;
  color: #303133;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cb-item .cb-meta {
  font-size: 12px;
  color: var(--cb-muted);
}

.cb-inline-online {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  vertical-align: middle;
}

.cb-inline-online svg {
  width: 14px;
  height: 14px;
  display: block;
}

.cb-inline-online-count {
  font-weight: 600;
  color: #606266;
}

.cb-badge {
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #f56c6c;
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  padding: 0 5px;
}

.cb-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--cb-bg);
  position: relative;
  --cb-composer-offset: 190px;
}

.cb-main-head {
  padding: 10px 12px;
  border-bottom: 1px solid var(--cb-border);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cb-main-left {
  min-width: 0;
  flex: 1 1 auto;
}

.cb-main-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  width: 100%;
}

.cb-main-title-row [data-cb-panel-close] {
  margin-left: auto;
}

.cb-main-title {
  font-size: 15px;
  font-weight: 600;
  color: #303133;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cb-main-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--cb-muted);
}

.cb-online {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cb-online svg {
  width: 16px;
  height: 16px;
  display: block;
}

.cb-online-count {
  font-weight: 600;
  color: #606266;
}

.cb-online-unit {
  color: var(--cb-muted);
}

.cb-search {
  display: flex;
  gap: 8px;
}

.cb-mobile-online {
  flex: 0 0 auto;
  color: var(--cb-muted);
}

.cb-side-mask {
  display: none;
}

.cb-input,
.cb-select {
  height: var(--cb-control-height);
  line-height: calc(var(--cb-control-height) - 2px);
  border: 1px solid var(--cb-border);
  border-radius: 4px;
  background: #fff;
  color: var(--cb-text);
  padding: 0 10px;
  font-size: 12px;
  margin: 0;
}

.cb-input {
  appearance: none;
  -webkit-appearance: none;
}

.cb-input[data-cb-search-input],
.cb-input[data-cb-keyword-input],
.cb-input[data-cb-user-uid],
.cb-input[data-cb-group-title],
.cb-input[data-cb-group-members],
.cb-input[data-cb-group-settings-add-input],
.cb-input[data-cb-search-modal-input],
.cb-input[data-cb-settings-avatar-url],
.cb-input[data-cb-settings-keywords] {
  height: var(--cb-control-height) !important;
  min-height: var(--cb-control-height);
  line-height: calc(var(--cb-control-height) - 2px) !important;
  padding-top: 0;
  padding-bottom: 0;
  padding-left: 10px;
  padding-right: 10px;
}

.cb-btn[data-cb-upload-btn],
.cb-btn[data-cb-search-btn] {
  height: var(--cb-control-height) !important;
}

.cb-input:focus,
.cb-select:focus,
.cb-textarea:focus {
  outline: 0;
  border-color: #66b1ff;
}

.cb-search .cb-input {
  width: 180px;
}

.cb-search .cb-btn {
  height: var(--cb-control-height);
}

.cb-messages {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overscroll-behavior: contain;
}

.cb-new-tip {
  position: absolute;
  right: 14px;
  bottom: calc(var(--cb-composer-offset) + 2px);
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.14);
  cursor: pointer;
  z-index: 18;
  line-height: 1;
  margin: 0;
}

.cb-new-tip.is-show {
  display: flex;
}

.cb-new-tip svg {
  width: 18px;
  height: 18px;
  display: block;
  color: var(--cb-primary);
  pointer-events: none;
}

.cb-new-tip .cb-new-count {
  font-size: 12px;
  font-weight: 700;
  color: #303133;
}

/* QQ-like conversation bubbles */
.cb-msg-row {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 8px;
}

.cb-msg-row:not(.is-own) .cb-avatar {
  cursor: pointer;
}

.cb-msg-row:not(.is-own) .cb-avatar:hover {
  filter: brightness(0.98);
}

.cb-msg-row.is-own {
  justify-content: flex-end;
}

.cb-msg-row .cb-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
}

.cb-msg-row .cb-avatar[src=""] {
  visibility: hidden;
}

.cb-bubble-wrap {
  max-width: min(720px, 82%);
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.cb-msg-row.is-own .cb-bubble-wrap {
  align-items: flex-end;
}

.cb-bubble-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 11px;
  color: var(--cb-muted);
  padding: 0 2px;
}

.cb-bubble-meta .cb-time {
  display: none;
}

.cb-msg-row:hover .cb-bubble-meta .cb-time {
  display: inline;
}

.cb-msg-row.is-own .cb-bubble-meta {
  justify-content: flex-end;
  text-align: right;
}

.cb-bubble-meta .cb-user {
  font-weight: 700;
  color: #606266;
}

.cb-bubble-meta .cb-time {
  color: var(--cb-muted);
}

.cb-bubble {
  position: relative;
  display: inline-block;
  max-width: 100%;
  border-radius: 14px;
  padding: 8px 12px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  word-break: break-word;
}

.cb-bubble.is-tiny {
  min-width: 38px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.cb-bubble.is-tiny .cb-bubble-body {
  line-height: 1;
}

.cb-msg-row.is-own .cb-bubble {
  background: #cfe8ff;
}

.cb-bubble::before {
  content: "";
  display: none;
  position: absolute;
  bottom: 12px;
  width: 0;
  height: 0;
  border: 7px solid transparent;
}

.cb-msg-row:not(.is-own) .cb-bubble::before {
  left: -12px;
  border-right-color: #ffffff;
}

.cb-msg-row.is-own .cb-bubble::before {
  right: -12px;
  border-left-color: #cfe8ff;
}

.cb-bubble-body {
  font-size: 14px;
  line-height: 1.6;
  color: #303133;
}

.cb-bubble-body p {
  margin: 0;
}

.cb-bubble-body > :first-child {
  margin-top: 0;
}

.cb-bubble-body > :last-child {
  margin-bottom: 0;
}

.cb-bubble-body pre {
  margin: 6px 0 0;
  padding: 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.04);
  border: 0;
  overflow: auto;
}

.cb-root .cb-bubble-body .cb-md p + p {
  margin-top: 6px;
}

.cb-root .cb-bubble-body .cb-md a {
  color: #409eff;
  text-decoration: none;
}

.cb-root .cb-bubble-body .cb-md a:hover {
  text-decoration: underline;
}

.cb-root .cb-bubble-body .cb-md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  padding: 1px 5px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.06);
}

.cb-root .cb-msg-row.is-own .cb-bubble-body .cb-md code {
  background: rgba(255, 255, 255, 0.65);
}

.cb-root .cb-bubble-body .cb-md pre code {
  background: transparent;
  padding: 0;
}

.cb-root .cb-bubble-body .cb-md .cb-md-image {
  display: inline-flex;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: #fff;
}

.cb-root .cb-bubble-body .cb-md .cb-md-img {
  display: block;
  width: auto;
  height: auto;
  max-width: 280px;
  max-height: 220px;
  object-fit: cover;
}

.cb-root .cb-bubble-body .cb-md .cb-md-list {
  margin: 4px 0 0 18px;
  padding: 0;
}

.cb-root .cb-bubble-body .cb-md .cb-md-list li {
  margin: 2px 0;
}

.cb-root .cb-bubble-body .cb-md .cb-md-task-list {
  list-style: none;
  margin-left: 0;
  padding-left: 0;
}

.cb-root .cb-bubble-body .cb-md-task {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.cb-root .cb-bubble-body .cb-md-task-box {
  width: 14px;
  height: 14px;
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 4px;
  margin-top: 2px;
  flex: 0 0 14px;
  position: relative;
  background: rgba(255, 255, 255, 0.7);
}

.cb-root .cb-bubble-body .cb-md-task.is-done .cb-md-task-box {
  background: #67c23a;
  border-color: #67c23a;
}

.cb-root .cb-bubble-body .cb-md-task.is-done .cb-md-task-box::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: 2px solid #fff;
  border-top: 0;
  border-left: 0;
  transform: rotate(45deg);
}

.cb-root .cb-bubble-body .cb-md-task-text {
  flex: 1;
  min-width: 0;
}

.cb-bubble .cb-reply-box {
  margin: 0 0 8px;
  padding: 6px 8px;
  border-left: 0;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.035);
  font-size: 12px;
  color: #606266;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cb-bubble .cb-reply-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.cb-bubble .cb-reply-name {
  font-size: 11px;
  font-weight: 700;
  color: #606266;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1 1 auto;
}

.cb-bubble .cb-reply-jump {
  flex: 0 0 auto;
  opacity: 0.6;
  display: inline-flex;
  align-items: center;
}

.cb-bubble .cb-reply-jump svg {
  width: 14px;
  height: 14px;
  display: block;
  pointer-events: none;
}

.cb-bubble .cb-reply-body {
  font-size: 12px;
  color: #909399;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.cb-bubble .cb-reply-media {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.cb-bubble .cb-reply-thumb {
  width: auto;
  height: auto;
  max-width: 220px;
  max-height: 160px;
  border-radius: 10px;
  object-fit: contain;
  display: block;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.cb-bubble .cb-reply-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
}

.cb-bubble .cb-reply-box:hover {
  background: rgba(64, 158, 255, 0.12);
}

.cb-msg-row.is-own .cb-bubble .cb-reply-box {
  background: rgba(255, 255, 255, 0.55);
  border-color: rgba(0, 0, 0, 0.04);
}

.cb-msg-row.is-own .cb-bubble .cb-reply-box:hover {
  background: rgba(255, 255, 255, 0.78);
}

.cb-bubble .cb-attachments {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cb-bubble.is-attachments-only {
  padding: 6px 8px;
}

.cb-bubble.is-attachments-only .cb-attachments {
  margin-top: 0;
}

.cb-msg-system {
  margin: 8px 0;
  text-align: center;
  font-size: 12px;
  color: #909399;
}

.cb-msg-row.is-jump-flash .cb-bubble {
  box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.35), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.cb-msg-system.is-jump-flash {
  color: var(--cb-primary);
}

/* reply-box base kept for compatibility; bubble overrides above */
.cb-reply-box {
  margin: 4px 0 8px;
  padding: 6px 8px;
  border-left: 3px solid #a0cfff;
  background: #f5faff;
  border-radius: 4px;
  font-size: 12px;
  color: #606266;
}

.cb-attachments {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cb-attach {
  text-decoration: none;
}

.cb-attach-image {
  display: inline-flex;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: #fff;
}

.cb-attach-image img {
  display: block;
  width: auto;
  height: auto;
  max-width: 280px;
  max-height: 200px;
  object-fit: cover;
}

.cb-attach-image:hover img {
  filter: brightness(0.98);
}

.cb-attach-file {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid #dcdfe6;
  border-radius: 10px;
  background: #fff;
  color: #303133;
  font-size: 12px;
  max-width: 100%;
}

.cb-file-badge {
  font-size: 11px;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 8px;
  background: #f5f7fa;
  color: #606266;
  border: 1px solid rgba(0, 0, 0, 0.05);
  flex: 0 0 auto;
}

.cb-file-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
}

.cb-file-size {
  color: var(--cb-muted);
  flex: 0 0 auto;
}

.cb-bubble-actions {
  display: flex;
  gap: 10px;
  padding: 0 2px;
}

.cb-msg-row.is-own .cb-bubble-actions {
  justify-content: flex-end;
}

.cb-bubble-actions button {
  border: 0;
  background: transparent;
  color: #409eff;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}

.cb-input-wrap {
  --cb-composer-gap: 6px;
  border: 1px solid var(--cb-border);
  border-top-color: #ebeef5;
  border-radius: 10px;
  margin: 4px 6px 6px;
  background: #fff;
  padding: 4px 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: var(--cb-composer-gap);
}

.cb-input-wrap > * {
  margin: 0;
}

.cb-input-tools {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  margin-bottom: 0;
  width: 100%;
  min-width: 0;
  height: var(--cb-control-height);
}

.cb-input-tools .cb-btn {
  height: var(--cb-control-height);
  flex: 0 0 auto;
}

.cb-input-tools [data-cb-keyword-input] {
  height: var(--cb-control-height);
  flex: 1 1 auto;
  min-width: 0;
  align-self: center;
  box-sizing: border-box;
}

/* Hard override for theme CSS: force controls to be truly centered and same-height. */
.cb-root .cb-input-tools .cb-btn {
  height: var(--cb-control-height) !important;
  min-height: var(--cb-control-height) !important;
}

.cb-root .cb-input-tools input[data-cb-keyword-input],
.cb-root .cb-search input[data-cb-search-input],
.cb-root .cb-dm-tools input[data-cb-user-uid],
.cb-root .cb-modal input[data-cb-group-title],
.cb-root .cb-modal input[data-cb-group-members],
.cb-root .cb-modal input[data-cb-group-settings-add-input],
.cb-root .cb-modal input[data-cb-search-modal-input],
.cb-root .cb-modal input[data-cb-settings-avatar-url],
.cb-root .cb-modal input[data-cb-settings-keywords] {
  height: var(--cb-control-height) !important;
  min-height: var(--cb-control-height) !important;
  line-height: var(--cb-control-height) !important;
  padding: 0 10px !important;
  margin: 0 !important;
  font: inherit !important;
  font-size: 12px !important;
  box-sizing: border-box !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
}

.cb-textarea {
  width: 100%;
  min-height: 96px;
  max-height: 156px;
  border: 1px solid var(--cb-border);
  border-radius: 8px;
  background: #fff;
  color: #303133;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.65;
  resize: none;
}

.cb-pending-files {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.cb-pending-files:empty {
  display: none;
}

.cb-file-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  font-size: 12px;
  color: #606266;
}

.cb-file-pill button {
  border: 0;
  background: transparent;
  cursor: pointer;
  color: #909399;
  padding: 0 2px;
  line-height: 1;
}

.cb-status-row {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  font-size: 12px;
  color: var(--cb-muted);
}

.cb-status-row > div:first-child {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  min-height: var(--cb-control-height);
}

.cb-status-row > div:last-child {
  flex: 0 0 auto;
}

.cb-status-row [data-cb-send] {
  height: var(--cb-control-height);
  min-width: 64px;
  padding: 0 12px;
  border-radius: 4px;
  font-size: 12px;
}

.cb-typing {
  color: var(--cb-primary);
}

.cb-login-tip {
  margin-top: 0;
  font-size: 12px;
  color: #e6a23c;
}

.cb-emoji {
  position: absolute;
  right: 12px;
  bottom: var(--cb-composer-offset);
  width: 248px;
  max-height: 176px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  padding: 6px;
  display: none;
  z-index: 20;
}

.cb-emoji.is-open {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(30px, 1fr));
  gap: 4px;
  justify-items: center;
}

.cb-emoji button {
  border: 0;
  background: transparent;
  border-radius: 999px;
  height: 30px;
  width: 30px;
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

.cb-emoji button:hover {
  background: rgba(64, 158, 255, 0.12);
}

.cb-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100000;
}

.cb-modal.is-open {
  display: flex;
}

.cb-modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.32);
}

.cb-modal-card {
  position: relative;
  width: 520px;
  max-width: calc(100vw - 24px);
  background: #fff;
  border: 1px solid var(--cb-border);
  border-radius: 12px;
  box-shadow: 0 16px 46px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}

.cb-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 12px;
  border-bottom: 1px solid var(--cb-border);
  background: #fff;
}

.cb-modal-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--cb-text);
}

.cb-modal-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cb-modal-alert {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(245, 108, 108, 0.25);
  background: #fef0f0;
  color: #f56c6c;
  font-size: 12px;
  line-height: 1.5;
}

.cb-search-modal-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cb-search-modal-top .cb-input {
  flex: 1 1 auto;
  min-width: 0;
}

.cb-search-modal-results {
  max-height: min(52vh, 520px);
  overflow: auto;
  border: 1px solid var(--cb-border);
  border-radius: 12px;
  background: #fff;
  overscroll-behavior: contain;
}

.cb-search-hit {
  padding: 10px 12px;
  border-bottom: 1px solid var(--cb-border);
  cursor: pointer;
}

.cb-search-hit:last-child {
  border-bottom: 0;
}

.cb-search-hit:hover {
  background: #f5f7fa;
}

.cb-search-hit-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--cb-muted);
}

.cb-search-hit-user {
  font-weight: 700;
  color: var(--cb-text);
}

.cb-search-hit-time {
  white-space: nowrap;
}

.cb-search-hit-body {
  margin-top: 4px;
  font-size: 13px;
  color: #303133;
  line-height: 1.45;
  word-break: break-word;
}

.cb-form-row {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 10px;
  align-items: start;
}

.cb-form-label {
  font-size: 12px;
  color: var(--cb-muted);
  padding-top: 6px;
}

.cb-form-control {
  min-width: 0;
}

.cb-form-help {
  margin-top: 6px;
  font-size: 12px;
  color: var(--cb-muted);
}

.cb-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--cb-text);
  line-height: 1.2;
  user-select: none;
}

.cb-check input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
}

.cb-email-types {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 8px;
}

.cb-conv-settings-title {
  font-weight: 700;
  color: var(--cb-text);
}

.cb-avatar-setting {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.cb-avatar-preview {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: #f5f7fa;
  border: 1px solid rgba(0, 0, 0, 0.08);
  flex: 0 0 auto;
}

.cb-attach-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.cb-attach-usage {
  font-size: 12px;
  color: var(--cb-muted);
}

.cb-attach-list {
  max-height: min(42vh, 320px);
  overflow: auto;
  border: 1px solid var(--cb-border);
  border-radius: 12px;
  background: #fff;
  overscroll-behavior: contain;
}

.cb-attach-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--cb-border);
}

.cb-attach-row:last-child {
  border-bottom: 0;
}

.cb-attach-row.is-expired {
  background: rgba(0, 0, 0, 0.02);
}

.cb-attach-main {
  min-width: 0;
  flex: 1 1 auto;
}

.cb-attach-name {
  font-size: 13px;
  color: var(--cb-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cb-attach-row.is-expired .cb-attach-name {
  color: var(--cb-muted);
}

.cb-attach-time {
  margin-top: 2px;
  font-size: 12px;
  color: var(--cb-muted);
  white-space: nowrap;
}

.cb-group-settings-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--cb-text);
  word-break: break-word;
}

.cb-group-add {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}

.cb-group-add .cb-input {
  flex: 1 1 auto;
  min-width: 0;
}

.cb-group-add .cb-icon-btn {
  flex: 0 0 auto;
}

.cb-member-list {
  max-height: min(42vh, 320px);
  overflow: auto;
  border: 1px solid var(--cb-border);
  border-radius: 12px;
  background: #fff;
  overscroll-behavior: contain;
}

.cb-member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--cb-border);
}

.cb-member-row:last-child {
  border-bottom: 0;
}

.cb-member-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.cb-member-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: #f5f7fa;
  border: 1px solid rgba(0, 0, 0, 0.08);
  flex: 0 0 auto;
}

.cb-member-info {
  min-width: 0;
  flex: 1 1 auto;
}

.cb-member-name {
  font-size: 13px;
  color: var(--cb-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cb-member-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--cb-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cb-member-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.cb-tag {
  font-size: 11px;
  line-height: 1;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--cb-border);
  color: var(--cb-muted);
  background: #fff;
}

.cb-group-settings-foot {
  gap: 8px;
}

.cb-group-files-list {
  max-height: min(52vh, 520px);
  overflow: auto;
  border: 1px solid var(--cb-border);
  border-radius: 12px;
  background: #fff;
  overscroll-behavior: contain;
}

.cb-group-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--cb-border);
}

.cb-group-file:last-child {
  border-bottom: 0;
}

.cb-group-file:hover {
  background: #f5f7fa;
}

.cb-group-file-main {
  min-width: 0;
  flex: 1 1 auto;
}

.cb-group-file-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.cb-group-file-info {
  min-width: 0;
  flex: 1 1 auto;
}

.cb-group-file-thumb {
  width: 40px;
  height: 32px;
  object-fit: cover;
  border-radius: 8px;
  background: #f5f7fa;
  border: 1px solid rgba(0, 0, 0, 0.08);
  flex: 0 0 auto;
}

.cb-group-file-icon {
  width: 40px;
  height: 32px;
  border-radius: 8px;
  background: #f5f7fa;
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--cb-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  letter-spacing: 0.08em;
  flex: 0 0 auto;
}

.cb-group-file-name {
  font-size: 13px;
  color: var(--cb-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cb-group-file-meta {
  margin-top: 2px;
  font-size: 12px;
  color: var(--cb-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cb-group-file-actions {
  flex: 0 0 auto;
}

.cb-group-file-actions .cb-btn {
  height: 28px;
  padding: 0 10px;
}

.cb-modal-foot {
  padding: 10px 12px;
  border-top: 1px solid var(--cb-border);
  background: #fff;
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 920px) {
  .cb-panel {
    right: 8px;
    bottom: 72px;
    width: calc(100vw - 16px);
    height: calc(100vh - 96px);
    max-height: calc(100vh - 96px);
  }

  .cb-sidebar {
    width: 250px;
  }

  .cb-main {
    --cb-composer-offset: 178px;
  }

  .cb-input-wrap {
    margin: 6px 8px 8px;
  }

  .cb-textarea {
    min-height: 96px;
    max-height: 160px;
  }
}

@media (max-width: 720px) {
  .cb-panel {
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    border: 0;
  }

  .cb-sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 86vw;
    max-width: 320px;
    transform: translateX(-105%);
    transition: transform 0.18s ease;
    z-index: 6;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
    border-right: 1px solid var(--cb-border);
  }

  .cb-root .cb-only-mobile {
    display: flex !important;
  }

  .cb-mobile-online {
    display: inline-flex !important;
    align-items: center;
  }

  .cb-side-mask {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.22);
    z-index: 5;
  }

  .cb-panel.is-side-open .cb-side-mask {
    display: block;
  }

  .cb-panel.is-side-open .cb-sidebar {
    transform: translateX(0);
  }

  .cb-dm-tools .cb-input {
    width: 110px;
  }

  .cb-main {
    --cb-composer-offset: 168px;
  }

  .cb-main-head {
    padding: 10px;
    flex-wrap: wrap;
  }

  .cb-main-sub {
    display: none;
  }

  .cb-search {
    width: 100%;
  }

  .cb-search .cb-input {
    width: auto;
    min-width: 0;
    flex: 1 1 auto;
  }

  .cb-input-wrap {
    margin: 2px;
    padding: 4px;
    border-radius: 8px;
    --cb-composer-gap: 4px;
  }

  .cb-input-tools {
    gap: 3px;
    margin-bottom: 0;
    flex-wrap: nowrap;
  }

  .cb-textarea {
    min-height: 76px;
    max-height: 124px;
  }

  .cb-status-row {
    align-items: center;
    gap: 4px;
  }

  .cb-status-row > div:first-child {
    flex: 1 1 auto;
  }
}
