#gqScheduleAiControlModal {
  position: fixed;
  inset: 0;
  z-index: 28000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, .54);
}

.gq-sac-dialog {
  width: min(1080px, 100%);
  max-height: min(860px, 94vh);
  overflow: auto;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  background: #f8fbff;
  color: #0f172a;
  box-shadow: 0 30px 100px rgba(15, 23, 42, .3);
}

.gq-sac-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid #dbe4f0;
  background: #fff;
  padding: 20px 22px;
}

.gq-sac-head span {
  color: #2563eb;
  font-size: 12px;
  font-weight: 900;
}

.gq-sac-head h2 {
  margin: 4px 0 0;
  font-size: 22px;
  line-height: 1.3;
}

.gq-sac-head p {
  margin: 6px 0 0;
  color: #64748b;
  font-size: 13px;
  line-height: 1.6;
}

.gq-sac-head > button {
  display: inline-flex;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  background: #fff;
  color: #475569;
  font-size: 22px;
  cursor: pointer;
}

.gq-sac-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, .85fr);
  gap: 16px;
  padding: 18px 22px 22px;
}

.gq-sac-main,
.gq-sac-sources {
  min-width: 0;
  border: 1px solid #dbe4f0;
  border-radius: 11px;
  background: #fff;
  padding: 16px;
}

.gq-sac-guide {
  border-left: 3px solid #2563eb;
  background: #eff6ff;
  padding: 12px 14px;
}

.gq-sac-guide strong,
.gq-sac-source-head strong {
  color: #123f7d;
  font-size: 14px;
  font-weight: 900;
}

.gq-sac-guide p,
.gq-sac-source-head p {
  margin: 5px 0 0;
  color: #475569;
  font-size: 12px;
  line-height: 1.65;
}

.gq-sac-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.gq-sac-chips button,
.gq-sac-csv,
.gq-sac-source-actions button {
  min-height: 32px;
  border: 1px solid #bfdbfe;
  border-radius: 7px;
  background: #fff;
  padding: 5px 9px;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.gq-sac-chips button:hover,
.gq-sac-csv:hover,
.gq-sac-source-actions button:hover {
  border-color: #60a5fa;
  background: #eff6ff;
}

.gq-sac-label {
  display: block;
  margin: 18px 0 7px;
  color: #334155;
  font-size: 13px;
  font-weight: 900;
}

#gqSacPrompt {
  display: block;
  width: 100%;
  min-height: 150px;
  resize: vertical;
  border: 1px solid #b9c8da;
  border-radius: 8px;
  background: #fff;
  padding: 11px 12px;
  color: #0f172a;
  font: inherit;
  font-size: 13px;
  line-height: 1.65;
  outline: none;
}

#gqSacPrompt:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .14);
}

.gq-sac-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 12px;
}

.gq-sac-actions button {
  min-height: 40px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.gq-sac-secondary {
  background: #fff;
  color: #334155;
}

.gq-sac-primary {
  border-color: #2563eb !important;
  background: #2563eb;
  color: #fff;
}

.gq-sac-primary:hover {
  background: #1d4ed8;
}

.gq-sac-feedback {
  min-height: 20px;
  margin-top: 9px;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.5;
}

.gq-sac-source-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 12px;
}

.gq-sac-source-head b {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #ecfdf5;
  padding: 5px 8px;
  color: #047857;
  font-size: 11px;
}

.gq-sac-upload {
  display: grid;
  gap: 4px;
  margin-top: 13px;
  border: 1px dashed #93c5fd;
  border-radius: 9px;
  background: #f8fbff;
  padding: 13px;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.gq-sac-upload:hover {
  border-color: #2563eb;
  background: #eff6ff;
}

.gq-sac-upload input {
  display: none;
}

.gq-sac-upload small {
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.55;
}

.gq-sac-csv {
  width: 100%;
  margin-top: 8px;
}

[data-source-list] {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.gq-sac-source {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid #edf2f7;
  padding-top: 10px;
}

.gq-sac-source strong,
.gq-sac-source span,
.gq-sac-source small {
  display: block;
}

.gq-sac-source strong {
  overflow: hidden;
  color: #0f172a;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gq-sac-source span,
.gq-sac-source small {
  margin-top: 3px;
  color: #64748b;
  font-size: 11px;
  line-height: 1.45;
}

.gq-sac-source-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.gq-sac-source-actions button {
  min-height: 28px;
  padding: 3px 7px;
  font-size: 11px;
}

.gq-sac-empty {
  margin-top: 12px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  padding: 13px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.gq-sac-entry-group {
  display: inline-flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 7px;
  margin-right: 8px;
}

.gq-sac-entry {
  min-height: 38px;
  border: 1px solid #93c5fd;
  border-radius: 8px;
  background: #eff6ff;
  padding: 0 11px;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.gq-sac-entry[data-ui-action="ai"] {
  border-color: #86c9d8;
  background: #e7f8fb;
  color: #075e72;
}

.gq-sac-entry:hover {
  filter: brightness(.97);
}

@media (max-width: 760px) {
  #gqScheduleAiControlModal {
    align-items: flex-end;
    padding: 0;
  }

  .gq-sac-dialog {
    max-height: 96dvh;
    border-radius: 14px 14px 0 0;
  }

  .gq-sac-head,
  .gq-sac-grid {
    padding: 15px;
  }

  .gq-sac-head h2 {
    font-size: 18px;
  }

  .gq-sac-grid {
    grid-template-columns: 1fr;
    gap: 11px;
  }

  .gq-sac-actions {
    justify-content: stretch;
  }

  .gq-sac-actions button {
    flex: 1;
  }

  .gq-sac-entry-group {
    width: 100%;
    margin-right: 0;
  }

  .gq-sac-entry {
    flex: 1;
  }
}
