/* Each settings card occupies its own natural-height row. */
body.av-cabinet .av-settings-section {
  container: av-settings / inline-size;
  min-width: 0;
}
body.av-cabinet .av-settings-section .av-settings-flow {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: stretch;
  min-width: 0;
}
body.av-cabinet .av-settings-section .av-settings-flow > .card {
  margin-bottom: 0 !important;
  min-width: 0;
}
body.av-cabinet .av-settings-activity {
  margin-top: 20px;
}
body.av-cabinet .av-settings-avatar-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 16px 24px;
}
body.av-cabinet .av-settings-avatar-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
body.av-cabinet .av-settings-avatar-controls > form {
  min-width: 0;
  max-width: 100%;
}
body.av-cabinet .av-settings-avatar-help {
  min-width: 0;
  overflow-wrap: anywhere;
}
body.av-cabinet .av-settings-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 20px;
  margin-bottom: 16px;
}
body.av-cabinet .av-settings-email-fields {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
body.av-cabinet .av-settings-fields > .mb-3 {
  min-width: 0;
  margin-bottom: 0 !important;
}
body.av-cabinet .av-settings-table {
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
}
body.av-cabinet .av-settings-table :is(th, td) {
  min-width: 0;
  white-space: normal !important;
  overflow-wrap: anywhere;
  vertical-align: middle;
  line-height: 1.5;
}
body.av-cabinet .av-settings-table > thead > tr > th {
  padding: 10px 16px !important;
}
body.av-cabinet .av-settings-table > tbody > tr > td {
  padding: 12px 16px !important;
}

/* Keep the native file picker inside one project-radius frame. Bootstrap's
   small-control negative margins otherwise expose square button corners. */
body.av-cabinet #avatarFile[type="file"] {
  min-width: 0;
  width: 320px;
  max-width: 100% !important;
  height: 45px;
  min-height: 45px;
  padding: 0;
  padding-inline-end: 12px;
  overflow: hidden;
  border: 1px solid #e0c394;
  border-radius: 12px;
  background: var(--av-input, #ffefe0);
  color: #74531e;
  font-family: var(--av-font);
  font-size: 14px;
  font-weight: 510;
  line-height: 43px;
  text-overflow: ellipsis;
}
body.av-cabinet #avatarFile[type="file"]::file-selector-button {
  height: 43px;
  margin: 0;
  margin-inline-end: 12px;
  padding: 0 12px;
  border: 0;
  border-inline-end: 1px solid #e0c394;
  border-radius: 11px 0 0 11px;
  background: #ffc76c40;
  color: #74531e;
  font: inherit;
  line-height: 43px;
  cursor: inherit;
}
body.av-cabinet #avatarFile[type="file"]:not(:disabled) {
  cursor: pointer;
}
body.av-cabinet #avatarFile[type="file"]:hover:not(:disabled):not([readonly])::file-selector-button {
  background: #ffc76c73;
  color: #5d4318;
}
body.av-cabinet #avatarFile[type="file"]:focus-visible {
  border-color: #d49850;
  outline: 2px solid #d49850;
  outline-offset: 3px;
  box-shadow: none;
}
body.av-cabinet #avatarFile[type="file"]:disabled {
  background: #fff1db;
  color: #99876a;
  cursor: not-allowed;
  opacity: .65;
}
body.av-cabinet #avatarFile[type="file"]:disabled::file-selector-button {
  background: #f9ecd5;
  color: #99876a;
}

@container av-settings (max-width: 760px) {
  body.av-cabinet .av-settings-avatar-body,
  body.av-cabinet .av-settings-fields {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Keep all values readable on a phone, without a horizontal table viewport. */
@container av-settings (max-width: 640px) {
  body.av-cabinet .av-settings-table-wrap {
    overflow: visible;
  }
  body.av-cabinet .av-settings-table,
  body.av-cabinet .av-settings-table > tbody {
    display: block;
    width: 100%;
  }
  body.av-cabinet .av-settings-table > thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  body.av-cabinet .av-settings-table > tbody > tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
    padding: 16px;
    border-bottom: 1px solid #e9d6be;
  }
  body.av-cabinet .av-settings-table > tbody > tr:last-child {
    border-bottom: 0;
  }
  body.av-cabinet .av-settings-table > tbody > tr > td {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 !important;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  body.av-cabinet .av-settings-table td[data-label]::before {
    content: attr(data-label);
    color: #80694b;
    font-family: var(--av-font);
    font-size: 12px;
    font-weight: 510;
    line-height: 1.4;
  }
  body.av-cabinet .av-settings-history-table td:first-child[data-label] {
    grid-column: 1 / -1;
  }
  body.av-cabinet .av-settings-table > tbody > tr > td[colspan] {
    display: block;
    grid-column: 1 / -1;
  }
}
