.settings-page {
  max-width: 560px;
  margin: 0 auto;
  padding: 6rem 2rem 4rem;
}

.settings-header {
  margin-bottom: 2rem;
}

.settings-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.settings-notice {
  background: var(--green-dim);
  border: 1px solid rgba(61,186,116,0.25);
  border-radius: 4px;
  color: var(--green);
  font-size: 13px;
  padding: 0.65rem 0.85rem;
  margin-bottom: 1.5rem;
}

.settings-error {
  background: var(--red-dim);
  border: 1px solid rgba(224,92,58,0.25);
  border-radius: 4px;
  color: var(--accent);
  font-size: 13px;
  padding: 0.65rem 0.85rem;
  margin-bottom: 1.5rem;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin-top: 2rem;
}

.settings-section {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.settings-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.25rem;
}

.settings-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: -0.25rem;
}

.api-key-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 4px;
  padding: 0.6rem 0.75rem;
}

.api-key-value {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--green);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.api-key-masked {
  color: var(--muted);
  letter-spacing: 0.05em;
}

.api-key-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.settings-back {
  margin-bottom: 0.75rem;
}

/* ─── Danger zone ─── */

.settings-section--danger {
  border-color: rgba(224,92,58,0.3);
  background: linear-gradient(135deg, var(--bg2), #200e0a);
  margin-top: 2rem;
}

.settings-section-title--danger {
  color: var(--accent);
}

/* button_to in settings generates a form — don't let it go block */
.settings-section--danger form { display: inline; margin: 0; }

.settings-actions {
  display: flex;
  margin-bottom: 2rem;
}

.btn-fixed {
  width: auto;
  padding-left: 2rem;
  padding-right: 2rem;
}

/* ─── Row layout for toggle rows ─── */
.form-group--row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
}

.form-group-text {
  flex: 1;
  min-width: 0;
}

/* ─── Toggle switch ─── */
.toggle {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
}

.toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 999px;
  transition: background 0.2s, border-color 0.2s;
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: var(--muted);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}

.toggle-input:checked + .toggle-track {
  background: rgba(61,186,116,0.25);
  border-color: var(--green);
}

.toggle-input:checked + .toggle-track .toggle-thumb {
  transform: translateX(16px);
  background: var(--green);
}

/* ─── Input with inline unit label ─── */
.input-with-unit {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.form-input--short {
  width: 80px;
}

.input-unit {
  font-size: 13px;
  color: var(--muted);
}

/* ─── Copy-to-clipboard widget ─── */

.copy-wrap {
  position: relative;
}

.copy-btn {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 3px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 8px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  line-height: 1.6;
  flex-shrink: 0;
}

/* Absolute variant for code blocks */
.copy-wrap .copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
}

.copy-btn:hover {
  color: var(--text);
  border-color: var(--muted);
}

.copy-btn--done {
  color: var(--green);
  border-color: var(--green);
}

/* ─── Notification channel list ─── */

.settings-section--notifications {
  margin-top: 2rem;
}

.channel-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.channel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
}

.channel-value {
  font-size: 13px;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-value--mono {
  font-family: var(--mono);
  font-size: 11px;
}

.channel-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.channel-group:first-of-type {
  padding-top: 0;
  border-top: none;
}

.channel-group-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.settings-link {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s;
}

.settings-link:hover { color: var(--text); }

.channel-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.channel-add-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.25rem;
}

.channel-add-row .form-input {
  flex: 1;
}

.channel-add-btn {
  flex-shrink: 0;
}
