.qbc-sb-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}

.qbc-sb-dialog {
  display: flex;
  flex-direction: column;
  width: min(980px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  border-radius: 18px;
  background: #f8fafc;
  box-shadow: 0 30px 70px rgba(15, 23, 42, 0.28);
}

.qbc-sb-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 22px;
  background: linear-gradient(120deg, #2563eb, #4f46e5);
  color: #fff;
  border-radius: 18px 18px 0 0;
}

.qbc-sb-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}

.qbc-sb-subtitle {
  margin: 6px 0 0;
  font-size: 12px;
  opacity: 0.86;
}

.qbc-sb-close {
  border: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  width: 30px;
  height: 30px;
  font-size: 14px;
  cursor: pointer;
}

.qbc-sb-close:hover {
  background: rgba(255, 255, 255, 0.26);
}

.qbc-sb-message {
  margin: 14px 22px 0;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 12.5px;
  background: #eff6ff;
  color: #1d4ed8;
}

.qbc-sb-message[data-tone="error"] {
  background: #fef2f2;
  color: #b91c1c;
}

.qbc-sb-message[data-tone="warn"] {
  background: #fff7ed;
  color: #c2410c;
}

.qbc-sb-message[data-tone="ok"] {
  background: #ecfdf5;
  color: #047857;
}

.qbc-sb-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 22px 4px;
}

.qbc-sb-btn {
  border: 1px solid #dbe3ee;
  border-radius: 10px;
  background: #fff;
  padding: 8px 14px;
  font-size: 12.5px;
  color: #334155;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.qbc-sb-btn:hover:not(:disabled) {
  border-color: #93c5fd;
  color: #1d4ed8;
}

.qbc-sb-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.qbc-sb-btn.primary {
  border: 0;
  background: linear-gradient(120deg, #2563eb, #4f46e5);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.24);
}

.qbc-sb-btn.small {
  padding: 5px 10px;
  font-size: 11.5px;
}

.qbc-sb-btn.danger {
  color: #b91c1c;
  border-color: #fecaca;
}

.qbc-sb-btn.danger:hover:not(:disabled) {
  background: #fef2f2;
}

.qbc-sb-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 22px 22px;
}

.qbc-sb-card {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  padding: 14px 16px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.qbc-sb-card.is-paused {
  opacity: 0.78;
}

.qbc-sb-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.qbc-sb-card-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.qbc-sb-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.qbc-sb-badge {
  border-radius: 999px;
  background: #f1f5f9;
  padding: 2px 9px;
  font-size: 11px;
  color: #475569;
}

.qbc-sb-badge.is-on {
  background: #ecfdf5;
  color: #047857;
}

.qbc-sb-badge.is-off {
  background: #fef2f2;
  color: #b91c1c;
}

.qbc-sb-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
  font-size: 12px;
  color: #64748b;
}

.qbc-sb-meta-accent {
  color: #c2410c;
}

.qbc-sb-targets {
  margin-top: 6px;
  font-size: 12px;
  color: #475569;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-theme="dark"] .qbc-sb-targets {
  color: #94a3b8;
}

.qbc-sb-preview {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 12px;
  line-height: 1.5;
  color: #475569;
  overflow-wrap: anywhere;
}

.qbc-sb-last {
  margin-top: 8px;
  font-size: 12px;
}

.qbc-sb-last.is-ok {
  color: #047857;
}

.qbc-sb-last.is-warn {
  color: #c2410c;
}

.qbc-sb-last.is-bad {
  color: #b91c1c;
}

.qbc-sb-error {
  margin-top: 6px;
  font-size: 11.5px;
  color: #b91c1c;
  overflow-wrap: anywhere;
}

.qbc-sb-failures {
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid #fecaca;
  border-radius: 10px;
  background: #fef2f2;
}

.qbc-sb-failures-title {
  font-size: 11.5px;
  font-weight: 600;
  color: #b91c1c;
  margin-bottom: 4px;
}

.qbc-sb-failure {
  font-size: 11.5px;
  color: #b91c1c;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.qbc-sb-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.qbc-sb-empty {
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  font-size: 12.5px;
  color: #64748b;
}

.qbc-sb-loading {
  padding: 40px;
  text-align: center;
  color: #64748b;
  font-size: 13px;
}

.qbc-sb-logs {
  margin: 0 22px 22px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  padding: 14px 16px;
}

.qbc-sb-logs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.qbc-sb-logs-head h4 {
  margin: 0;
  font-size: 13px;
  color: #0f172a;
}

.qbc-sb-log-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow: auto;
}

.qbc-sb-log {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  border-radius: 9px;
  background: #f8fafc;
  padding: 7px 10px;
  font-size: 11.5px;
  color: #475569;
}

.qbc-sb-log.is-ok .qbc-sb-log-status {
  color: #047857;
}

.qbc-sb-log.is-bad .qbc-sb-log-status {
  color: #b91c1c;
}

.qbc-sb-log-error {
  color: #b91c1c;
  overflow-wrap: anywhere;
}

/* 编辑器 */
.qbc-sb-editor-overlay {
  position: fixed;
  inset: 0;
  z-index: 1002;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.5);
}

.qbc-sb-editor {
  display: flex;
  flex-direction: column;
  width: min(720px, 100%);
  max-height: calc(100vh - 36px);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 30px 70px rgba(15, 23, 42, 0.3);
}

.qbc-sb-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
}

.qbc-sb-editor-head h4 {
  margin: 0;
  font-size: 15px;
  color: #0f172a;
}

.qbc-sb-editor-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 20px;
  overflow: auto;
}

.qbc-sb-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.qbc-sb-field[hidden] {
  display: none !important;
}

.qbc-sb-field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
}

.qbc-sb-hint {
  font-size: 11px;
  font-weight: 400;
  color: #94a3b8;
}

.qbc-sb-input,
.qbc-sb-textarea {
  width: 100%;
  border: 1px solid #dbe3ee;
  border-radius: 10px;
  background: #fff;
  padding: 9px 11px;
  font: inherit;
  font-size: 12.5px;
  color: #0f172a;
  outline: none;
}

.qbc-sb-input:focus,
.qbc-sb-textarea:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.qbc-sb-textarea {
  resize: vertical;
  line-height: 1.7;
}

.qbc-sb-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.qbc-sb-weekdays {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.qbc-sb-weekday {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid #dbe3ee;
  border-radius: 9px;
  padding: 6px 10px;
  font-size: 12px;
  color: #475569;
  cursor: pointer;
}

.qbc-sb-bot-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.qbc-sb-bot {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #dbe3ee;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
}

.qbc-sb-bot-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.qbc-sb-bot-copy strong {
  font-size: 12px;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qbc-sb-bot-copy span {
  font-size: 11px;
  color: #94a3b8;
}

.qbc-sb-dot {
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-radius: 50%;
  background: #cbd5e1;
}

.qbc-sb-dot.is-online {
  background: #22c55e;
}

.qbc-sb-templates {
  display: flex;
  gap: 8px;
}

.qbc-sb-template {
  flex: 1 1 0;
  border: 1px solid #dbe3ee;
  border-radius: 10px;
  background: #fff;
  padding: 8px 10px;
  font-size: 12px;
  color: #475569;
  cursor: pointer;
}

.qbc-sb-template[data-active="true"] {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 700;
}

.qbc-sb-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
}

.qbc-sb-switch-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.qbc-sb-switch-copy strong {
  font-size: 12.5px;
  color: #0f172a;
}

.qbc-sb-switch-copy span {
  font-size: 11px;
  color: #94a3b8;
}

.qbc-sb-switch-control {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}

.qbc-sb-switch-control input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.qbc-sb-switch-track {
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background 0.18s ease;
}

.qbc-sb-switch-track::after {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  margin: 2px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s ease;
}

.qbc-sb-switch-control input:checked + .qbc-sb-switch-track {
  background: #2563eb;
}

.qbc-sb-switch-control input:checked + .qbc-sb-switch-track::after {
  transform: translateX(18px);
}

.qbc-sb-editor-error {
  border-radius: 10px;
  background: #fef2f2;
  padding: 9px 11px;
  font-size: 12px;
  color: #b91c1c;
}

.qbc-sb-editor-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

html[data-theme="dark"] .qbc-sb-dialog,
html[data-theme="dark"] .qbc-sb-editor {
  background: #0f172a;
  color: #e2e8f0;
}

html[data-theme="dark"] .qbc-sb-card,
html[data-theme="dark"] .qbc-sb-logs {
  background: #111c33;
  border-color: #1e293b;
}

html[data-theme="dark"] .qbc-sb-card-title,
html[data-theme="dark"] .qbc-sb-logs-head h4,
html[data-theme="dark"] .qbc-sb-editor-head h4,
html[data-theme="dark"] .qbc-sb-bot-copy strong,
html[data-theme="dark"] .qbc-sb-switch-copy strong,
html[data-theme="dark"] .qbc-sb-field-label {
  color: #e2e8f0;
}

html[data-theme="dark"] .qbc-sb-meta,
html[data-theme="dark"] .qbc-sb-empty,
html[data-theme="dark"] .qbc-sb-loading,
html[data-theme="dark"] .qbc-sb-log,
html[data-theme="dark"] .qbc-sb-hint,
html[data-theme="dark"] .qbc-sb-bot-copy span,
html[data-theme="dark"] .qbc-sb-switch-copy span {
  color: #94a3b8;
}

html[data-theme="dark"] .qbc-sb-btn,
html[data-theme="dark"] .qbc-sb-input,
html[data-theme="dark"] .qbc-sb-textarea,
html[data-theme="dark"] .qbc-sb-template,
html[data-theme="dark"] .qbc-sb-bot,
html[data-theme="dark"] .qbc-sb-weekday,
html[data-theme="dark"] .qbc-sb-switch {
  background: #0f172a;
  border-color: #1e293b;
  color: #e2e8f0;
}

html[data-theme="dark"] .qbc-sb-log,
html[data-theme="dark"] .qbc-sb-badge {
  background: #16233d;
  color: #cbd5e1;
}

html[data-theme="dark"] .qbc-sb-editor-foot {
  background: #0b1324;
  border-color: #1e293b;
}

html[data-theme="dark"] .qbc-sb-failures {
  background: #2a1315;
  border-color: #7f1d1d;
}

html[data-theme="dark"] .qbc-sb-failures-title,
html[data-theme="dark"] .qbc-sb-failure {
  color: #fca5a5;
}

html[data-theme="dark"] .qbc-sb-preview {
  background: #0f172a;
  border-color: #1e293b;
  color: #cbd5e1;
}

.qbc-sb-group-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
}

.qbc-sb-group-bot {
  grid-column: 1 / -1;
  font-size: 11.5px;
  font-weight: 600;
  color: #64748b;
  padding-top: 2px;
}

html[data-theme="dark"] .qbc-sb-group-bot {
  color: #94a3b8;
}

.qbc-sb-group-name {
  cursor: text;
  border-bottom: 1px dashed rgba(100, 116, 139, 0.45);
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.qbc-sb-group-name:hover {
  border-bottom-color: #2563eb;
  color: #2563eb;
}

html[data-theme="dark"] .qbc-sb-group-name:hover {
  border-bottom-color: #60a5fa;
  color: #60a5fa;
}

.qbc-sb-group-rename {
  width: 100%;
  max-width: 180px;
  padding: 1px 4px;
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid #93c5fd;
  border-radius: 4px;
  background: #fff;
  color: #0f172a;
  outline: none;
}

html[data-theme="dark"] .qbc-sb-group-rename {
  background: #0f172a;
  border-color: #3b82f6;
  color: #e2e8f0;
}

@media (max-width: 640px) {
  .qbc-sb-grid,
  .qbc-sb-bot-list,
  .qbc-sb-group-list {
    grid-template-columns: 1fr;
  }

  .qbc-sb-templates {
    flex-direction: column;
  }
}
