/* A policy can expose many rule controls; keep the full form reachable. */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #19223588;
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal {
  position: relative;
  width: 100%;
  height: calc(100dvh - 48px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 48px max(24px, calc((100vw - 960px) / 2));
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 20px 50px #11182755;
}

.modal > *:not(.modal-close) {
  max-width: 900px;
  margin-right: auto;
  margin-left: auto;
}

.modal h2 {
  margin-top: 0;
  font-size: 28px;
}

.policy-create-error {
  margin-top: 14px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid #f3c4c8;
  border-radius: 8px;
  background: #fff1f2;
  color: #a12a39;
  font-size: 13px;
  font-weight: 600;
}

.modal label {
  margin-top: 18px;
  margin-bottom: 18px;
}

.modal-actions {
  margin-top: 28px;
  margin-bottom: 20px;
}

.modal-close {
  position: fixed;
  top: 34px;
  right: 40px;
  font-size: 30px;
}

#ruleTypeChoices,
#triggerChoices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px 24px;
  margin-top: 10px;
}

#policyRuleTypes {
  margin: 18px auto;
  padding: 0;
  border: 0;
}

#policyRuleTypes legend {
  padding: 0;
  font-size: 12px;
  font-weight: 700;
}

#ruleTypeChoices > span,
#triggerChoices > span {
  display: flex;
  align-items: center;
  gap: 9px;
}

#ruleTypeChoices input,
#triggerChoices input {
  width: 16px;
  height: 16px;
  margin: 0;
  flex: 0 0 auto;
}

#ruleTypeChoices label,
#triggerChoices label {
  display: inline;
  width: auto;
  margin: 0;
  font-weight: 600;
}

@media (max-width: 700px) {
  .modal {
    height: calc(100dvh - 24px);
    padding: 40px 20px 28px;
  }

  .modal-close {
    top: 20px;
    right: 22px;
  }
}
