.custom-setup {
  padding-bottom: 5px;
}

.setup-page .custom-setup .setup-heading {
  margin-top: 0;
}

.custom-setup-intro {
  margin: 6px 0 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.custom-setup-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -7px 0 14px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.custom-setup-banner p {
  flex: 1;
  padding-block: 4px;
}

.custom-setup-reset {
  flex-shrink: 0;
  min-height: 44px;
  padding: 0 4px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--primary);
  font-size: 12px;
  font-weight: 500;
}

.custom-setup-reset:hover {
  background: var(--primary-soft);
}

.custom-setup-form {
  display: grid;
  min-width: 0;
  gap: 13px;
}

.custom-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.custom-field label,
.custom-opening summary {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
}

.custom-setup-form input[type="text"],
.custom-setup-form textarea {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 11px;
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
}

.custom-setup-form textarea {
  display: block;
  max-height: 150px;
  resize: vertical;
}

.custom-setup-form input[type="text"]::placeholder,
.custom-setup-form textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}

.custom-setup-form input[type="text"]:focus,
.custom-setup-form textarea:focus {
  border-color: var(--primary);
}

.custom-opening {
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
}

.custom-opening summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  cursor: pointer;
  list-style: none;
}

.custom-opening summary::-webkit-details-marker {
  display: none;
}

.custom-opening summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.custom-opening summary::after {
  content: "";
  width: 7px;
  height: 7px;
  margin: -3px 2px 0;
  border-right: 1px solid var(--primary);
  border-bottom: 1px solid var(--primary);
  transform: rotate(45deg);
}

.custom-opening[open] summary::after {
  margin-top: 3px;
  transform: rotate(225deg);
}

.custom-opening textarea {
  margin-bottom: 10px;
  background: var(--surface);
}

.opening-speaker {
  min-width: 0;
  margin: 14px 0 0;
  padding: 0;
  border: 0;
}

.custom-setup-form .opening-speaker {
  margin: 0;
}

.opening-speaker legend {
  margin-bottom: 6px;
  padding: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}

.opening-speaker__options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.opening-speaker__options label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
}

.opening-speaker__options label:has(:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.opening-speaker__options input {
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--primary);
}

.custom-optional {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.custom-setup-error {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.custom-setup-error:empty {
  display: none;
}

.custom-setup-error:not(:empty) {
  color: var(--primary-pressed);
}

@media (max-height: 720px) {
  .custom-setup-intro {
    margin: 4px 0 14px;
  }

  .custom-setup-form {
    gap: 10px;
  }

  .custom-setup-form textarea {
    max-height: 130px;
  }
}
