.settings-dialog {
  padding: 24px 24px 20px;
  max-width: 420px;
  width: calc(100vw - 32px);
}

.settings-dialog .dialog-header {
  margin-bottom: 22px;
}

.settings-dialog label {
  font-size: 0.74rem;
}

.settings-dialog input {
  font-size: 0.78rem;
}

.settings-dialog>form>div:not(:last-child) {
  margin-bottom: 12px;
}

/* A legend sits on the fieldset's top edge, so padding here would open a gap
   between the heading and its own controls — the breathing room between
   sections has to come from the margin. */
.settings-dialog .settings-section {
  border: 0;
  padding: 0;
  margin: 0 0 32px;
}

/* The actions already carry their own space above them. */
.settings-dialog .settings-section:last-of-type {
  margin-bottom: 0;
}

.settings-dialog .settings-section > legend {
  padding: 0;
  margin: 0 0 4px;
  font-size: 0.95rem;
  font-weight: 600;
}

.settings-dialog .settings-hint {
  margin: 0 0 14px;
  font-size: 0.78rem;
  color: var(--muted);
}

.settings-dialog .settings-radio[hidden] {
  display: none;
}

.settings-dialog .settings-radio {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  margin: 0;
  font-size: 0.9rem;
  cursor: pointer;
}

.settings-dialog .settings-radio input[type="radio"] {
  width: auto;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  flex: 0 0 auto;
  accent-color: var(--accent);
}

.settings-dialog #aiKeyLink {
  color: #86efac;
  font-size: 0.8rem;
  white-space: nowrap;
}

.settings-dialog select {
  appearance: none;
  padding: 10px 36px 10px 12px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: light-dark(Canvas, var(--bg)) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='%239ca3af' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><path d='M1 1.5 6 6.5 11 1.5'/></svg>") no-repeat right 12px center / 12px 8px;
  color: light-dark(CanvasText, var(--text));
  font-size: 0.85rem;
}

.settings-dialog .settings-select {
  width: 100%;
}

.settings-dialog .provider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-dialog .provider-row select {
  flex: 1;
  min-width: 0;
}

.settings-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 28px;
}

.settings-logs-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  text-decoration: underline;
  text-underline-offset: 2px;
  opacity: 0.6;
  cursor: pointer;
  min-height: unset;
}

/* One auto margin, after the last of the links — with the rule on the class
   itself both got one and the free space split around Refresh, parking it in
   the middle of nowhere. (:last-of-type can't say this: Save is a button too.) */
.settings-logs-link + .settings-logs-link {
  margin-right: auto;
}

@media (hover: hover) {
  .settings-logs-link:hover { opacity: 1; }
}
