/* Inputs, fields, checkboxes, form layouts and the danger zone. */

.input {
  display: block;
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--input-border);
  border-radius: 0;
  background: var(--input-bg);
  color: var(--fg);
  font-size: 14px;
  line-height: 1.4;
}
.input:hover {
  border-color: var(--fg);
}
.input:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 0;
  border-color: var(--fg);
}
.input[aria-invalid="true"] {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}
.input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.input::placeholder {
  color: var(--muted);
  opacity: 0.85;
}
.input--mono {
  font-family: var(--mono);
  font-size: 13px;
}
.input--short {
  max-width: 140px;
}
.input--code {
  font-family: var(--mono);
  font-size: 20px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
}
textarea.input {
  resize: vertical;
  min-height: 60px;
}
select.input {
  appearance: none;
  padding-right: 30px;
  cursor: pointer;
  background: var(--input-bg)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0h10L5 6z' fill='%23141414'/%3E%3C/svg%3E")
    no-repeat right 10px center;
}
@media (prefers-color-scheme: dark) {
  select.input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0h10L5 6z' fill='%23f1eee4'/%3E%3C/svg%3E");
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.field__label {
  font-size: 12.5px;
  font-weight: 650;
}
.field__hint {
  font-size: 12px;
  color: var(--muted);
}
.field__hint code {
  padding: 0 0.3em;
  background: var(--tint);
  overflow-wrap: anywhere;
}
.field__error {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent-ink);
}
.field__error:empty {
  display: none;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  cursor: pointer;
}
.check__input {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--fg);
  cursor: pointer;
}
.check__input:disabled {
  cursor: not-allowed;
}
.check__input:disabled + .check__text {
  opacity: 0.55;
}
.check__text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.check__text > span:first-child {
  font-weight: 600;
}
.check__hint {
  font-size: 12px;
  color: var(--muted);
}

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.form--panel {
  max-width: 980px;
  padding: 16px;
  border: 1px solid var(--hair);
  background: var(--surface);
}
.form--panel > .fieldset {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.form--inline {
  max-width: 760px;
}
.form__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
  align-items: start;
}
.form__grid--3 {
  grid-template-columns: 140px minmax(0, 1fr);
}
.form__actions {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}
.form__actions--stack {
  flex-direction: column;
}
.form-error {
  padding: 9px 12px;
  border-left: 3px solid var(--accent);
  background: var(--accent-tint);
  font-weight: 600;
  overflow-wrap: anywhere;
}
.fieldset:disabled {
  opacity: 0.75;
}
@media (max-width: 640px) {
  .form__grid,
  .form__grid--3 {
    grid-template-columns: minmax(0, 1fr);
  }
}

.scopes {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.scopes__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px 16px;
}
.scopes .check__text > span:first-child {
  font-family: var(--mono);
  font-size: 13px;
}

.disclosure {
  border-top: 1px solid var(--hair);
  padding-top: 10px;
}
.disclosure > summary {
  cursor: pointer;
  font-weight: 650;
  list-style-position: inside;
}
.disclosure[open] {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.disclosure > summary:focus-visible {
  outline-offset: 2px;
}

.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border: 1px solid var(--accent);
  background: var(--accent-tint);
}
.danger-zone p {
  flex: 1 1 280px;
  max-width: 70ch;
}
.fieldset > legend {
  padding: 0;
}
