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

.qbc-lr-dialog {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 820px;
  max-height: 88vh;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
  overflow: hidden;
}

.qbc-lr-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid #eef2f7;
}

.qbc-lr-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #0f172a;
}

.qbc-lr-subtitle {
  margin: 4px 0 0;
  font-size: 12px;
  color: #94a3b8;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.qbc-lr-close {
  border: 0;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 8px;
}

.qbc-lr-close:hover {
  background: #f1f5f9;
  color: #475569;
}

.qbc-lr-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 22px;
  border-bottom: 1px solid #f1f5f9;
}

.qbc-lr-meta {
  font-size: 12px;
  color: #64748b;
}

.qbc-lr-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 22px;
  background: #f8fafc;
}

.qbc-lr-rule {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}

.qbc-lr-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  color: #0f172a;
}

.qbc-lr-summary::-webkit-details-marker {
  display: none;
}

.qbc-lr-index {
  flex: none;
  font-size: 11px;
  color: #64748b;
  background: #f1f5f9;
  border-radius: 6px;
  padding: 2px 6px;
}

.qbc-lr-keywords {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qbc-lr-badge {
  flex: none;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
}

.qbc-lr-badge.is-off {
  background: #f1f5f9;
  color: #64748b;
}

.qbc-lr-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 14px 16px;
  border-top: 1px solid #f1f5f9;
}

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

.qbc-lr-label {
  font-size: 12px;
  color: #475569;
}

.qbc-lr-textarea,
.qbc-lr-select {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: #0f172a;
  background: #ffffff;
  outline: none;
  font-family: inherit;
  resize: vertical;
}

.qbc-lr-textarea:focus,
.qbc-lr-select:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15);
}

.qbc-lr-textarea.is-reply {
  min-height: 110px;
}

.qbc-lr-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.qbc-lr-row .qbc-lr-field {
  flex: 1;
  min-width: 160px;
}

.qbc-lr-targets {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.qbc-lr-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
}

.qbc-lr-actions {
  display: flex;
  justify-content: flex-end;
}

.qbc-lr-btn {
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #334155;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
}

.qbc-lr-btn:hover {
  background: #f8fafc;
}

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

.qbc-lr-btn.is-primary:hover {
  background: #1d4ed8;
}

.qbc-lr-btn.is-primary:disabled {
  opacity: 0.6;
  cursor: default;
}

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

.qbc-lr-btn.is-danger:hover {
  background: #fef2f2;
}

.qbc-lr-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid #eef2f7;
  background: #ffffff;
}

.qbc-lr-status {
  margin-right: auto;
  font-size: 12px;
  color: #64748b;
}

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

.qbc-lr-status.is-error {
  color: #b91c1c;
}

.qbc-lr-empty {
  margin: 0;
  padding: 36px 16px;
  text-align: center;
  font-size: 13px;
  color: #94a3b8;
}

html[data-theme="dark"] .qbc-lr-dialog {
  background: #0f172a;
}

html[data-theme="dark"] .qbc-lr-title {
  color: #e2e8f0;
}

html[data-theme="dark"] .qbc-lr-header,
html[data-theme="dark"] .qbc-lr-toolbar,
html[data-theme="dark"] .qbc-lr-footer {
  border-color: #1e293b;
  background: #0f172a;
}

html[data-theme="dark"] .qbc-lr-body {
  background: #0b1220;
}

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

html[data-theme="dark"] .qbc-lr-summary {
  color: #e2e8f0;
}

html[data-theme="dark"] .qbc-lr-index {
  background: #1e293b;
  color: #cbd5e1;
}

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

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

html[data-theme="dark"] .qbc-lr-textarea,
html[data-theme="dark"] .qbc-lr-select {
  background: #0b1220;
  border-color: #1e293b;
  color: #e2e8f0;
}

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

html[data-theme="dark"] .qbc-lr-btn:hover {
  background: #16233c;
}

html[data-theme="dark"] .qbc-lr-check {
  color: #cbd5e1;
}

@media (max-width: 640px) {
  .qbc-lr-overlay {
    padding: 0;
  }

  .qbc-lr-dialog {
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .qbc-lr-header,
  .qbc-lr-toolbar,
  .qbc-lr-footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .qbc-lr-body {
    padding: 12px 16px;
  }
}
