* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #f4f6f9;
  color: #172235;
  font:
    14px/1.5 system-ui,
    sans-serif;
}
header {
  background: #12213a;
  color: white;
  padding: 20px 32px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
}
header strong {
  font-size: 23px;
}
header span {
  margin-left: 18px;
  color: #bac7dd;
}
main {
  max-width: 1600px;
  margin: auto;
  padding: 20px 28px;
}
h1 {
  font-size: 25px;
  margin: 0 0 20px;
}
h2 {
  margin-top: 0;
}
section {
  background: white;
  padding: 24px;
  border: 1px solid #dfe5ed;
  border-radius: 10px;
}
#login,
#setup {
  max-width: 430px;
  margin: 40px auto;
}
nav,
.toolbar,
.heading {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.heading {
  justify-content: space-between;
}
.heading h1 {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
  border-radius: 5px;
  border: 1px solid #bdc9d8;
  padding: 9px 11px;
}
button {
  cursor: pointer;
  background: #225ad0;
  color: white;
  border-color: #225ad0;
  font-weight: 600;
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
button.secondary {
  background: white;
  color: #34445d;
  border-color: #bdc9d8;
}
button.danger {
  background: #a42630;
  border-color: #a42630;
}
button[aria-current="page"] {
  background: #12213a;
  border-color: #12213a;
}
label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-weight: 500;
}
input[type="checkbox"] {
  width: 18px;
  height: 18px;
}
input,
select,
textarea {
  background: white;
  color: #172235;
}
form > label {
  margin-bottom: 16px;
}
textarea {
  width: 100%;
  font-family: ui-monospace, monospace;
}
.table-wrap {
  overflow: auto;
  border: 1px solid #dfe5ed;
  border-radius: 7px;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  text-align: left;
  padding: 10px;
  vertical-align: top;
  border-bottom: 1px solid #e3e8ef;
}
th {
  background: #eef2f8;
  white-space: nowrap;
  font-size: 12px;
}
td input:not([type="checkbox"]) {
  min-width: 155px;
  width: 100%;
}
td input[type="number"] {
  min-width: 80px;
  width: 85px;
}
td select {
  min-width: 90px;
}
td button {
  margin: 0 5px 5px 0;
  white-space: nowrap;
}
td small {
  display: block;
  color: #66758c;
  max-width: 200px;
  overflow-wrap: anywhere;
}
.muted {
  color: #5d6b80;
}
details {
  margin: 18px 0;
  padding: 12px;
  background: #f6f8fc;
  border: 1px solid #dfe5ed;
  border-radius: 6px;
}
summary {
  cursor: pointer;
  font-weight: 600;
}
details .toolbar {
  margin-top: 12px;
}
#message:empty {
  display: none;
}
#message {
  padding: 12px;
  background: #e3efe9;
  border-radius: 6px;
  white-space: pre-wrap;
}
.error,
#message.error {
  color: #a02029;
  background: #fff1f1;
}
#editorError,
#previewError {
  color: #a02029;
  white-space: pre-wrap;
}
dialog {
  width: min(1000px, 94vw);
  max-height: 90vh;
  border: 1px solid #c3cedd;
  border-radius: 10px;
  padding: 25px;
}
dialog::backdrop {
  background: #12213a88;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
pre {
  background: #f1f4f8;
  padding: 15px;
  border-radius: 6px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 50vh;
  overflow: auto;
}
#setupLink {
  padding: 16px;
  background: #eaf2ff;
  margin-bottom: 16px;
}
#setupLinkValue {
  width: 100%;
  margin-bottom: 10px;
}
[hidden] {
  display: none !important;
}
@media (max-width: 700px) {
  main {
    padding: 12px;
  }
  section {
    padding: 15px;
  }
  header {
    padding: 15px;
  }
  header span {
    display: none;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .toolbar {
    align-items: stretch;
  }
  .toolbar label {
    flex: 1;
    min-width: 120px;
  }
}

#rulesTable td:has(small) {
  min-width: 105px;
}
#rulesTable td:last-child {
  min-width: 150px;
}
