.qbc-api-card {
  margin: 0 0 16px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  overflow: hidden;
}

.qbc-api-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(180deg, #f8fafc, #fff);
  border-bottom: 1px solid #eef2f7;
}

.qbc-api-title h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
}

.qbc-api-title p {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: #64748b;
  max-width: 720px;
}

.qbc-api-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.qbc-api-status {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
}

.qbc-api-status[data-tone="ok"] { color: #15803d; }
.qbc-api-status[data-tone="error"] { color: #b91c1c; }

.qbc-api-toggle,
.qbc-api-btn {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  padding: 6px 12px;
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.qbc-api-toggle:hover,
.qbc-api-btn:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

.qbc-api-btn:disabled,
.qbc-api-toggle:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.qbc-api-btn.is-primary {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
}

.qbc-api-btn.is-primary:hover {
  border-color: #1d4ed8;
  background: #1d4ed8;
}

.qbc-api-btn.is-danger {
  border-color: #fecaca;
  color: #b91c1c;
  background: #fff;
}

.qbc-api-btn.is-danger:hover {
  background: #fef2f2;
  border-color: #fca5a5;
}

.qbc-api-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.qbc-api-empty {
  margin: 0;
  font-size: 13px;
  color: #64748b;
}

.qbc-api-item {
  border: 1px solid #eef2f7;
  border-radius: 10px;
  padding: 12px;
  background: #fcfdff;
}

.qbc-api-item-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.qbc-api-item-head strong {
  font-size: 14px;
  color: #0f172a;
}

.qbc-api-item-head code {
  font-size: 12px;
  color: #475569;
  background: #f1f5f9;
  border-radius: 6px;
  padding: 2px 6px;
}

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

.qbc-api-badge[data-state="enabled"] { background: #dcfce7; color: #15803d; }
.qbc-api-badge[data-state="disabled"] { background: #f1f5f9; color: #64748b; }
.qbc-api-badge[data-state="maintenance"] { background: #ffedd5; color: #c2410c; }

.qbc-api-key-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.qbc-api-key {
  flex: 1 1 260px;
  min-width: 180px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  padding: 7px 10px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #334155;
}

.qbc-api-caps {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.qbc-api-cap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #334155;
  cursor: pointer;
}

.qbc-api-cap.is-locked {
  color: #94a3b8;
  cursor: not-allowed;
}

.qbc-api-rate {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #334155;
}

.qbc-api-rate input {
  width: 72px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 12px;
  text-align: center;
}

.qbc-api-meta {
  margin-top: 8px;
  font-size: 12px;
  color: #64748b;
}

.qbc-api-note {
  margin: 6px 0 0;
  font-size: 12px;
  color: #b45309;
}

.qbc-api-help {
  border-top: 1px dashed #e2e8f0;
  padding-top: 10px;
  font-size: 12px;
  color: #475569;
}

.qbc-api-help summary {
  cursor: pointer;
  font-weight: 500;
  color: #334155;
}

.qbc-api-help pre {
  margin: 10px 0 0;
  padding: 12px;
  border-radius: 10px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 11px;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre;
}

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

html[data-theme="dark"] .qbc-api-head {
  background: #111c31;
  border-bottom-color: #1e293b;
}

html[data-theme="dark"] .qbc-api-title h3 { color: #e2e8f0; }
html[data-theme="dark"] .qbc-api-title p { color: #94a3b8; }
html[data-theme="dark"] .qbc-api-item { background: #111c31; border-color: #1e293b; }
html[data-theme="dark"] .qbc-api-item-head strong { color: #e2e8f0; }
html[data-theme="dark"] .qbc-api-item-head code { background: #1e293b; color: #cbd5e1; }
html[data-theme="dark"] .qbc-api-key { background: #0b1220; border-color: #334155; color: #e2e8f0; }
html[data-theme="dark"] .qbc-api-btn,
html[data-theme="dark"] .qbc-api-toggle { background: #111c31; border-color: #334155; color: #cbd5e1; }
html[data-theme="dark"] .qbc-api-cap,
html[data-theme="dark"] .qbc-api-rate { color: #cbd5e1; }
html[data-theme="dark"] .qbc-api-rate input { background: #0b1220; border-color: #334155; color: #e2e8f0; }
html[data-theme="dark"] .qbc-api-meta { color: #94a3b8; }
html[data-theme="dark"] .qbc-api-help { border-top-color: #1e293b; color: #94a3b8; }

@media (max-width: 720px) {
  .qbc-api-head {
    flex-direction: column;
  }
  .qbc-api-head-actions {
    width: 100%;
    justify-content: space-between;
  }
  .qbc-api-key {
    flex: 1 1 100%;
  }
}
.qbc-api-audit {
  margin-top: 10px;
  border-top: 1px dashed #e2e8f0;
  padding-top: 8px;
  font-size: 12px;
}

.qbc-api-audit summary {
  cursor: pointer;
  color: #334155;
  font-weight: 500;
}

.qbc-api-audit-body {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}

.qbc-api-audit-row {
  display: grid;
  grid-template-columns: 132px 82px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  color: #475569;
}

.qbc-api-audit-row[data-status="failed"] .qbc-api-audit-detail {
  color: #b91c1c;
}

.qbc-api-audit-time {
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
}

.qbc-api-audit-action {
  color: #0f172a;
  font-weight: 500;
}

.qbc-api-audit-detail {
  word-break: break-all;
}

html[data-theme="dark"] .qbc-api-audit {
  border-top-color: #1e293b;
}

html[data-theme="dark"] .qbc-api-audit summary,
html[data-theme="dark"] .qbc-api-audit-action {
  color: #e2e8f0;
}

html[data-theme="dark"] .qbc-api-audit-row {
  color: #94a3b8;
}

@media (max-width: 720px) {
  .qbc-api-audit-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
}
.qbc-api-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.qbc-api-title-row h3 {
  margin: 0;
}

.qbc-api-tier {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: #1d4ed8;
  background: #dbeafe;
}

html[data-theme="dark"] .qbc-api-tier {
  color: #bfdbfe;
  background: #1e3a8a;
}
