.qbc-ir-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-ir-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-ir-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 22px;
  background: linear-gradient(120deg, #f59e0b, #ef4444);
  color: #fff;
  border-radius: 18px 18px 0 0;
}

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

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

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

.qbc-ir-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

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

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

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

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

.qbc-ir-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 14px 22px 0;
}

.qbc-ir-select,
.qbc-ir-input {
  border: 1px solid #d7dee8;
  border-radius: 10px;
  background: #fff;
  color: #0f172a;
  font-size: 13px;
  padding: 8px 10px;
  outline: none;
}

.qbc-ir-select {
  min-width: 220px;
}

.qbc-ir-input.small {
  width: 82px;
}

.qbc-ir-select:focus,
.qbc-ir-input:focus {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.qbc-ir-btn {
  border: 1px solid #d7dee8;
  border-radius: 10px;
  background: #fff;
  color: #334155;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 14px;
  cursor: pointer;
}

.qbc-ir-btn:hover {
  background: #f1f5f9;
}

.qbc-ir-btn.primary {
  border-color: transparent;
  background: linear-gradient(120deg, #f59e0b, #ef4444);
  color: #fff;
}

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

.qbc-ir-btn.danger {
  border-color: #fecaca;
  color: #b91c1c;
  background: #fef2f2;
}

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

.qbc-ir-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 22px 0;
}

.qbc-ir-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  padding: 10px 14px;
}

.qbc-ir-stat strong {
  font-size: 18px;
  color: #0f172a;
}

.qbc-ir-stat span {
  font-size: 11.5px;
  color: #64748b;
}

.qbc-ir-tabs {
  display: flex;
  gap: 8px;
  padding: 14px 22px 0;
}

.qbc-ir-tab {
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #fff;
  color: #475569;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 16px;
  cursor: pointer;
}

.qbc-ir-tab[data-active="true"] {
  border-color: transparent;
  background: #0f172a;
  color: #fff;
}

.qbc-ir-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 22px 22px;
}

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

.qbc-ir-field-label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: #334155;
}

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

.qbc-ir-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

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

.qbc-ir-switch-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

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

.qbc-ir-switch-copy span {
  font-size: 11.5px;
  color: #64748b;
}

.qbc-ir-switch-control {
  position: relative;
  display: inline-flex;
  width: 42px;
  height: 24px;
  flex: none;
}

.qbc-ir-switch-control input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.qbc-ir-switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background 0.18s ease;
}

.qbc-ir-switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s ease;
}

.qbc-ir-switch-control input:checked + .qbc-ir-switch-track {
  background: #ef4444;
}

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

.qbc-ir-milestones {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.qbc-ir-milestone {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  padding: 8px 12px;
  font-size: 12.5px;
  color: #475569;
}

.qbc-ir-commands {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.qbc-ir-command {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: #475569;
}

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

.qbc-ir-table-wrap {
  padding: 14px 22px 22px;
  overflow-x: auto;
}

.qbc-ir-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.qbc-ir-table th,
.qbc-ir-table td {
  border-bottom: 1px solid #e8edf5;
  padding: 9px 10px;
  text-align: left;
  white-space: nowrap;
}

.qbc-ir-table th {
  font-size: 11.5px;
  font-weight: 700;
  color: #64748b;
  background: #f8fafc;
}

.qbc-ir-table td {
  color: #334155;
}

.qbc-ir-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 700;
}

.qbc-ir-badge.pending {
  background: #fffbeb;
  color: #b45309;
}

.qbc-ir-badge.valid {
  background: #ecfdf5;
  color: #047857;
}

.qbc-ir-badge.rejected {
  background: #fef2f2;
  color: #b91c1c;
}

.qbc-ir-empty {
  padding: 26px 0;
  text-align: center;
  color: #94a3b8;
  font-size: 12.5px;
}

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

html[data-theme="dark"] .qbc-ir-stat,
html[data-theme="dark"] .qbc-ir-switch,
html[data-theme="dark"] .qbc-ir-milestone,
html[data-theme="dark"] .qbc-ir-tab {
  background: #111c31;
  border-color: #1f2a44;
  color: #cbd5e1;
}

html[data-theme="dark"] .qbc-ir-stat strong,
html[data-theme="dark"] .qbc-ir-switch-copy strong,
html[data-theme="dark"] .qbc-ir-field-label,
html[data-theme="dark"] .qbc-ir-table td {
  color: #e2e8f0;
}

html[data-theme="dark"] .qbc-ir-input,
html[data-theme="dark"] .qbc-ir-select,
html[data-theme="dark"] .qbc-ir-btn {
  background: #0b1526;
  border-color: #26344f;
  color: #e2e8f0;
}

html[data-theme="dark"] .qbc-ir-btn.primary {
  background: linear-gradient(120deg, #f59e0b, #ef4444);
  color: #fff;
}

html[data-theme="dark"] .qbc-ir-table th {
  background: #111c31;
  color: #94a3b8;
}

html[data-theme="dark"] .qbc-ir-table th,
html[data-theme="dark"] .qbc-ir-table td {
  border-bottom-color: #1f2a44;
}

@media (max-width: 720px) {
  .qbc-ir-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .qbc-ir-grid,
  .qbc-ir-commands {
    grid-template-columns: minmax(0, 1fr);
  }
}
