:root {
  color-scheme: light;
  font-family: Arial, Helvetica, sans-serif;
  background: #f4f6f8;
  color: #17202a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid #1b5f8f;
  background: #1f75ad;
  color: #fff;
  border-radius: 6px;
  padding: 9px 13px;
  cursor: pointer;
}

button.secondary {
  background: #fff;
  color: #1f75ad;
}

button.danger {
  border-color: #9f2f2f;
  background: #c44444;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select,
textarea {
  width: 100%;
  min-height: 39px;
  border: 1px solid #c5ced8;
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: #17202a;
}

textarea {
  min-height: 140px;
  resize: vertical;
  font-family: Consolas, Monaco, monospace;
}

label {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
  font-weight: 700;
  color: #405060;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.topbar h1 {
  margin: 0 0 4px;
  font-size: 28px;
}

.topbar p {
  margin: 0;
  color: #627080;
}

.panel {
  background: #fff;
  border: 1px solid #d9e0e7;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(20, 35, 50, 0.04);
}

.connection {
  display: flex;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid #d9e0e7;
}

.tab-button {
  border-color: transparent;
  border-radius: 6px 6px 0 0;
  background: transparent;
  color: #405060;
  padding: 10px 14px;
}

.tab-button.active {
  border-color: #d9e0e7;
  border-bottom-color: #fff;
  background: #fff;
  color: #17202a;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.field {
  min-width: 0;
}

.hidden-field {
  display: none;
  margin-top: 8px;
}

.hidden-field.visible {
  display: block;
}

.grow {
  flex: 1 1 360px;
}

.token {
  flex: 1 1 280px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.persistence-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.backend-options {
  display: none;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.backend-options.visible {
  display: grid;
}

.full,
.form-actions {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.stacked-form .field {
  margin-bottom: 12px;
}

.panel-note {
  margin: 0 0 12px;
  font-size: 13px;
  color: #627080;
  line-height: 1.45;
}

.panel-note code {
  font-family: Consolas, Monaco, monospace;
  font-size: 12px;
}

.reveal-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 12px;
}

.reveal-row code {
  flex: 1;
  font-family: Consolas, Monaco, monospace;
  font-size: 12px;
  word-break: break-all;
  background: #eef2f6;
  border-radius: 6px;
  padding: 8px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-heading h2 {
  margin: 0;
  font-size: 18px;
}

.button-group {
  display: flex;
  gap: 8px;
}

.inline-form,
.decision-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.decision-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.check {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  white-space: nowrap;
  font-weight: 400;
}

.check input {
  width: auto;
  min-height: auto;
}

.list,
.request-card {
  border: 1px solid #e1e7ed;
  border-radius: 6px;
  min-height: 120px;
  padding: 10px;
  background: #fbfcfd;
}

.empty {
  color: #6d7782;
}

.realm-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto auto auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #e8edf2;
}

.realm-row:last-child {
  border-bottom: 0;
}

.realm-name {
  overflow-wrap: anywhere;
  font-family: Consolas, Monaco, monospace;
}

.realm-detail {
  min-width: 0;
}

.realm-meta {
  margin-top: 3px;
  color: #627080;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.token-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid #e8edf2;
}

.token-row:last-child {
  border-bottom: 0;
}

.token-detail {
  min-width: 0;
}

.token-title {
  overflow-wrap: anywhere;
  font-weight: 700;
}

.token-meta {
  margin-top: 3px;
  color: #627080;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  border-radius: 999px;
  padding: 3px 9px;
  background: #e8f3eb;
  color: #236b35;
  font-size: 12px;
  font-weight: 700;
}

.pill.open {
  background: #f3efe3;
  color: #7a5b16;
}

.request-card dl {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 6px 10px;
  margin: 0;
}

.request-card dt {
  color: #5f6b76;
  font-weight: 700;
}

.request-card dd {
  margin: 0;
  overflow-wrap: anywhere;
}

pre {
  min-height: 160px;
  max-height: 420px;
  overflow: auto;
  margin: 0;
  border: 1px solid #e1e7ed;
  border-radius: 6px;
  padding: 12px;
  background: #0f1720;
  color: #e7edf4;
  font-size: 13px;
}

@media (max-width: 860px) {
  .connection,
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .inline-form,
  .realm-row,
  .persistence-form,
  .backend-options {
    grid-template-columns: 1fr;
  }

  .full,
  .form-actions {
    grid-column: auto;
  }
}
