/* T1, T8, T9: the avatar, its menu and the Preferences dialog. */

.account {
  position: relative;
}

.account-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--c-neutral-9);
  cursor: pointer;
}

.account-trigger .initials {
  border: 1px solid var(--c-neutral-4);
  transition: border-color 200ms ease-in-out;
}

.account-open .account-trigger .initials {
  border-color: var(--c-blue);
}

.account-menu {
  position: absolute;
  top: 46px;
  right: 0;
  z-index: 35;
  width: 290px;
  padding: 6px;
  border: 1px solid var(--c-neutral-3);
  border-radius: 12px;
  background: var(--c-neutral-0);
  display: flex;
  flex-direction: column;
  row-gap: 2px;
}

/* Only a sheet has something to grab. */
.account-handle {
  display: none;
}

.account-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 14px;
}

.account-identity strong {
  display: block;
  font: var(--t-body-primary-500);
  color: var(--c-white);
}

.account-email {
  font: var(--t-body-small-300);
  color: var(--c-neutral-9);
}

.initials-big {
  width: 36px;
  height: 36px;
}

.account-divider {
  height: 1px;
  margin: 0 6px;
  background: var(--c-neutral-2);
}

/* Log out is a form so it can POST; the form itself takes no room. */
.account-logout {
  margin: 0;
}
.account-logout .account-row {
  width: 100%;
  font: inherit;
  text-align: left;
}

.account-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--c-neutral-12);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 200ms ease-in-out, color 200ms ease-in-out;
}

.account-row:hover {
  background: var(--c-neutral-1);
  color: var(--c-white);
}

.account-note {
  margin: 4px 12px 8px;
  font: var(--t-body-small-300);
  color: var(--c-neutral-9);
}

/* The card never scrolls: only the middle does, so Save is on screen the
   moment the dialog opens, at every height. */
.preferences-card {
  width: 640px;
  max-width: 100%;
  max-height: 92%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.preferences-head {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 24px 16px;
}

.preferences-head h2 {
  margin: 0 0 4px;
}

.preferences-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  row-gap: 24px;
}

.preferences-section {
  display: flex;
  flex-direction: column;
  row-gap: 16px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--c-neutral-2);
}

.preferences-section:last-child {
  border-bottom: none;
}

.preferences-label {
  margin: 0;
  font: var(--t-body-small-500);
  color: var(--c-neutral-9);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.preferences-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.preferences-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.preferences-foot {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-top: 1px solid var(--c-neutral-2);
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--c-neutral-3);
  border-radius: 100px;
  align-self: flex-start;
}

.segmented button,
.segmented span {
  padding: 6px 16px;
  border: none;
  border-radius: 100px;
  background: transparent;
  color: var(--c-neutral-11);
  cursor: pointer;
  transition: background-color 200ms ease-in-out, color 200ms ease-in-out;
}

.segmented .segmented-on {
  background: var(--c-neutral-1);
  color: var(--c-white);
}

/* A control that responds to the pointer but does nothing is worse than one
   that visibly ignores it. */
.segmented-off {
  border-color: var(--c-neutral-2);
  opacity: 0.45;
  cursor: not-allowed;
}

.segmented-off span {
  cursor: not-allowed;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--c-neutral-3);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 200ms ease-in-out;
}

.check-row:hover {
  border-color: var(--c-neutral-7);
}

.check-row input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--c-blue);
}

.check-row strong {
  display: block;
  color: var(--c-white);
}

@media (max-width: 768px) {
  /* The menu becomes a sheet: same three blocks, same order. */
  .account-menu {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    border-radius: 16px 16px 0 0;
    border-bottom: none;
    padding: 0 0 8px;
  }

  .account-handle {
    display: block;
    width: 40px;
    height: 4px;
    margin: 10px auto 6px;
    border-radius: 100px;
    background: var(--c-neutral-4);
  }

  .account-row {
    padding: 15px 16px;
    border-radius: 0;
  }

  .preferences-card {
    width: 100%;
    max-height: 100%;
    height: 100%;
    border-radius: 0;
  }

  .preferences-pair {
    grid-template-columns: minmax(0, 1fr);
  }

  .preferences-foot {
    flex-direction: column;
    align-items: stretch;
  }

  .preferences-foot .modal-actions .button {
    flex: 1;
    min-height: 48px;
  }

  .segmented button,
  .segmented span {
    padding: 9px 18px;
  }
}

/* A row whose mail meet does not send yet. Same treatment as the theme
   control: visible, stated, and not operable. */
.check-row-off {
  opacity: 0.45;
  cursor: not-allowed;
}

.check-row-off input {
  cursor: not-allowed;
}

.check-row-off:hover {
  border-color: var(--c-neutral-3);
}

.check-row strong .badge {
  margin-left: 8px;
  vertical-align: middle;
}
