/* Shared visual axis for ordinary icon + text controls across the project. */
:where(
  .site-brand,
  .form-brand,
  .auth-brand,
  .site-account,
  .toolbar-icon-button,
  .view-config-button,
  .title-actions button,
  .permission-add-group,
  .tool-add-button,
  .add-condition-button,
  .save-as-view,
  .add-record-inline,
  #add-question,
  #share-form,
  .open-shared-form,
  .factory-img-placeholder,
  .factory-image-local,
  .factory-add-spec,
  .factory-add-page,
  .factory-add-category
) {
  align-items: center;
}

:where(
  .toolbar-icon-button,
  .view-config-button,
  .title-actions button,
  .permission-add-group,
  .tool-add-button,
  .add-condition-button,
  .save-as-view,
  .add-record-inline,
  #add-question,
  #share-form,
  .open-shared-form,
  .factory-image-local,
  .factory-add-spec,
  .factory-add-page,
  .factory-add-category
) {
  display: inline-flex;
  gap: .42em;
  line-height: 1.2;
}

:where(
  .ui-leading-icon,
  .leading-icon,
  .view-tab-icon,
  .field-icon,
  .locked-field-icon,
  .search-symbol,
  .site-brand-logo,
  .auth-logo,
  .home-app-icon,
  .user-avatar
) {
  flex: 0 0 auto;
  align-self: center;
  vertical-align: middle;
}

:where(button,a,label,[role="button"]) > svg {
  display: block;
  flex: 0 0 auto;
  align-self: center;
  vertical-align: middle;
}

/* Number inputs stay editable while using the same plain input appearance everywhere. */
:where(input[type="number"]) {
  appearance: textfield;
  -moz-appearance: textfield;
}

:where(input[type="number"])::-webkit-inner-spin-button,
:where(input[type="number"])::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
}

/* Shared destructive icon button: use one red trash can everywhere an item is removed. */
button.danger-trash-button {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #e11d48;
  cursor: pointer;
  font-size: 0;
  line-height: 1;
  vertical-align: middle;
}

button.danger-trash-button:hover {
  background: #fff1f2;
  color: #be123c;
}

button.danger-trash-button:focus-visible {
  outline: 2px solid #fda4af;
  outline-offset: 2px;
}

button.danger-trash-button:disabled {
  opacity: .35;
  cursor: not-allowed;
}

button.danger-trash-button > svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

button.danger-trash-button.compact {
  width: 22px;
  height: 22px;
  flex-basis: 22px;
  border-radius: 5px;
}

button.danger-trash-button.compact > svg {
  width: 14px;
  height: 14px;
}

/* Shared disclosure control: collapsed points down; expanded points up. */
button.ui-disclosure-button {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  align-self: center;
  padding: 0;
  border: 1px solid #e4e7ec;
  border-radius: 50%;
  background: #fff;
  color: #2563eb;
  line-height: 1;
  box-shadow: 0 1px 3px rgb(16 24 40 / 8%);
  cursor: pointer;
}

button.ui-disclosure-button:hover {
  border-color: #b2ccff;
  background: #eff6ff;
}

button.ui-disclosure-button > .ui-disclosure-icon {
  display: block;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .16s ease;
}

button.ui-disclosure-button[aria-expanded="true"] > .ui-disclosure-icon {
  transform: rotate(180deg);
}
